question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MarkerView does not follow map on drag (Android)

See original GitHub issue

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.

Issue Analytics

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

github_iconTop GitHub Comments

11reactions
ombogdancommented, Dec 8, 2021

mapbox is the worst map in the world

2reactions
ferdicuscommented, Dec 8, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

MarkerView does not follow map on drag (Android) #1546
Describe the bug When using MarkerViews on Android, if you drag the map to another position, the marker will remain in the same...
Read more >
MarkerView does not follow map on drag (Android) - - Bountysource
When using MarkerView s on Android, if you drag the map to another position, the marker will remain in the same position on...
Read more >
React Native MabBox MarkerView issue - Stack Overflow
To add map in react native i am using @react-native-mapbox-gl/maps": "^8.1.0-rc.9, But docs are not that good so i tried from one medium...
Read more >
Markers | Maps SDK for Android - Google Developers
Markers are objects of type Marker , and are added to the map with the GoogleMap.addMarker(markerOptions) method. ... Markers are not draggable by...
Read more >
rnmapbox/Lobby - Gitter
Hey small question. I am trying to make the camera follow the user's location. This works perfectly on iOS. But for some reason...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found