maps: MarkerView does not follow map on drag (Android)

Describe the bug
When using MarkerViews on Android, if you drag the map to another position, the marker will remain in the same position on the screen rather than following the movement of the map. Once the drag has stopped, the marker seems to move to the correct location.

To Reproduce
This bug seems to be present any time a <MarkerView /> is used on Android.

It can actually be seen in the current example code for react-native-mapbox-gl under “Annotations/MarkerView”: https://github.com/react-native-mapbox-gl/maps/blob/master/example/src/examples/Annotations/MarkerView.js

Expected behavior
The marker should remain at the same position on the map while dragging.

Actual behavior
The marker remains at a static position on the screen rather than moving along with the map.

Screenshots
Here is a video of the bug viewed in the unaltered project example code: default_example_compressed_more

I also updated the example to include more MarkerViews to make it more apparent what is happening: many_markers_compressed

Versions (please complete the following information):

  • Platform: Android
  • Platform OS: Android 11
  • Device: Pixel 5 (Also Pixel 4 emulator)
  • Emulator/ Simulator: Both
  • Dev OS: macOS 11.5.2
  • react-native-mapbox-gl Version: 8.3.0
  • Mapbox GL version: (I’m honestly not sure how to find this, but it’s whatever is used by the example project.)
  • React Native Version 0.64.2 (Also seeing it in 0.65.1)

Additional context
It kind of looks like when a marker hits the edge of the screen it just get’s stuck there rather than being removed. Maybe there is a bug in the code checking for elements that are not within the visible map?

Something interesting to note is that this bug does not seem to occur with PointAnnotations, only MarkerViews.

I think this bug is specific to Android, as I am not seeing any problems on iOS.

Also, if you move the screen more slowly, you can see that the markers are slightly delayed in maintaining their correct location on the map. I’m not sure if that is even the same bug though.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 21 (7 by maintainers)

Most upvoted comments

mapbox is the worst map in the world

@ombogdan, thanks for helping to make it better 👍🏿

@jorisoudejans : looking forward to review a PR, that I’m sure would make many users of this repo pretty happy 😃

@traviswimer so mapbox released(ing) a almost rewrite of their libs with Kotlin and Swift - https://docs.mapbox.com/ios/beta/maps/guides/ https://docs.mapbox.com/android/beta/maps/guides/ and the <= v9 version we use is no longer seems to be maintained. No MarkerView like plugin seems to be exists for v10.

And there is MapLibre which is an open source fork of v9ish version

https://github.com/react-native-mapbox-gl/maps/discussions/1274

@traviswimer

Just to clarify the rich mapbox history, here a little write up with some links.

It’s all a bit confusing, I’ll try to show it with a flow:

   react-native-mapbox-gl/maps
          \ wraps /
           \     /
    mapbox/mapbox-gl-native-ios
  mapbox/mapbox-gl-native-android
          \ wraps /
           \     /
   mapbox/mapbox-gl-native 

The lib that was the center for the licensing debate was mapbox-gl-native, which moved to a closed source.
So no more open source changes happening since then.

Additionally the two SDK libs mapbox-gl-native-ios/mapbox-gl-native-android changed their distribution model (you need an access token in order to download it) and their licensing as well.

Shortly after, v10 of both SDKs was announced mapbox-maps-android/ mapbox-maps-ios which de facto have superseeded the old SDKs (they are no longer actively maintained by mapbox 😭 )

So all in all:

  • closed source/ changed licensing native rendering lib mapbox-gl-native
  • old open source/ changed licensing/ distribution model SDK libs
  • new open source/ changed licensing/ distribution model SDK libs

We are at the moment heading towards a crossroad with this repo, where we decide to either continue supporting mapbox after v10 or leaning towards the opensource fork of mapbox => mapLibre