nativescript-community/ui-mapbox

setOnMapClickListener is not working on iOS

Opened this issue · 8 comments

After switching from legacy repository to ui-mapbox, setOnMapClickListener is not working on iOS but it works on Android.
I see the promise is resolved but I never get into the listener.

I have the same problem on iOS.
On Android too, it doesn't work.

And unlike iOS, I have an error that starts in the terminal

System.err: An uncaught Exception occurred on "main" thread.
System.err: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
System.err: 
System.err: StackTrace:
System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
System.err:     at com.tns.gen.com.mapbox.mapboxsdk.maps.MapboxMap_OnMapClickListener.onMapClick(MapboxMap_OnMapClickListener.java:19)
System.err:     at com.mapbox.mapboxsdk.maps.MapGestureDetector.notifyOnMapClickListeners(MapGestureDetector.java:997)
System.err:     at com.mapbox.mapboxsdk.maps.MapGestureDetector$StandardGestureListener.onSingleTapConfirmed(MapGestureDetector.java:360)
System.err:     at com.mapbox.android.gestures.StandardGestureDetector$1.onSingleTapConfirmed(StandardGestureDetector.java:83)
System.err:     at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:323)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:107)
System.err:     at android.os.Looper.loop(Looper.java:214)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:7356)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Same thing here, i have problem with Android, the setOnMapClickListener doesn't work at all. Same error of the above comment.

I am also having this issue, but only on IOS. Although, I don't see any build errors, I'm using Angular integration.

I found the problem. PR is coming.

I sent a PR just for iOS, Because I was not able to produce this issue on Android. but as a workaround this may help you guys:

if you are going to listen to click events on a specific layer, which is not my case, just replace setOnMapClickListener with onMapEvent.

this.map.onMapEvent('click', 'layerId', () => console.log('clicked!'));

Any progress on resolving the setOnMapClickListener issue for ios?

any update for this issue?

Here It's mentioned that the PR has been committed manually. But I see the problematic code snippet still exists in the recent version. I'm going to make another PR.