NativeScript / plugins

@nativescript plugins to help with your developments.
https://docs.nativescript.org/plugins/index.html
Apache License 2.0
190 stars 108 forks source link

myLocationButtonEnabled not working on iOS #578

Closed dlcole closed 3 weeks ago

dlcole commented 6 months ago

On iOS, using v1.7.1 of @nativescript/google-maps and specifying

    map.myLocationEnabled = true;
    map.uiSettings.myLocationButtonEnabled = true;

causes the myLocation Button to be displayed and shows a shadow when selected, but the camera position/zoom does not change. The same code works correctly on Android.

dlcole commented 6 months ago

Working through this code in a debugger:

didTapMyLocationButtonForMapView(mapView: GMSMapView): boolean {
    this._owner?.get?.().notify?.({
        eventName: MapView.myLocationButtonTapEvent,
        object: this._owner?.get?.(),
    });
    return true;
}

I can see that there are no observers for the event. This is likely a hack, but if I return false instead of true, then the camera position moves to the current location, as expected.

This is in google-maps/index.ios.ts

SingleMalted commented 1 month ago

It would be nice to get this wired up for iOS.

Thanks