plugins icon indicating copy to clipboard operation
plugins copied to clipboard

myLocationButtonEnabled not working on iOS

Open dlcole opened this issue 1 year ago • 1 comments

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 avatar Apr 03 '24 19:04 dlcole

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

dlcole avatar Apr 03 '24 20:04 dlcole

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

Thanks

SingleMalted avatar Sep 03 '24 21:09 SingleMalted