amay077 / Xamarin.Forms.GoogleMaps

Map library for Xamarin.Forms using Google maps API
https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/
MIT License
546 stars 347 forks source link

Xamarin.Forms 3.2 - iOS Camera not updating #556

Closed ianvink closed 6 years ago

ianvink commented 6 years ago

VERSIONS

PLATFORMS

ACTUAL BEHAVIOR

Thank you for a wonderful tool!!!!!!

We updated to XF 3.2 and have found that the MoveToRegion() call for iOS doesn't update the map. Android is fine Map

    private void AddMapToDetailsView()
    {
        Device.BeginInvokeOnMainThread(() => {
            if (_map != null)
            {
                var detailItemWithAddress = DetailItemWithLatLng();
                if (detailItemWithAddress != null  )
                {
                    _map.IsVisible = true;
                    var pin = detailItemWithAddress.Pin;
                    _map.Pins.Add(pin);
                    _map.MoveToRegion(MapSpan.FromCenterAndRadius(pin.Position, Distance.FromMeters(500)), true);

                }
                else
                {
                    _map.IsVisible = false;
                }
            }
        });
    }
amay077 commented 6 years ago

Do you use Xamarin.Forms.GoogleMaps v3.0.3 ? v3.0.2 has this bug but fixed in v3.0.3.

And please try map.InitialCameraUpdate instead of map.MoveRegion .

ianvink commented 6 years ago

Hi amay077,

Thank you for your quick reply. I am on 3.0.3

I tried this, but get the standard Rome view only, the camera doesn't update:

var bounds = Xamarin.Forms.GoogleMaps.Bounds.FromPositions(new []{  pin.Position});
_map.InitialCameraUpdate = CameraUpdateFactory.NewBounds(bounds,5);
//Tried this too  _map.InitialCameraUpdate = CameraUpdateFactory.NewCameraPosition(new CameraPosition(pin.Position,1));
ianvink commented 6 years ago

Found the issue. If the Map.IsVisible == false then it won't update. In previous versions it would update.

Android always had to be visible