I suppose, that it is very important to have ability of dragging of markers. If there is a feature to place markers, there must be feature to edit them. But I can't find any info about this feature in react-native-mapbox-gl
This is part of the backlog for version 6 and is on the roadmap to be supported
@nitaliano Any progress with this?
When can we expect this functionality?
@nitaliano Is there any update with this feature? I can't find out the drag feature even in Maps SDK for android documentation.
@tayyabshabab Do you have any workaround for this?
@Madhavan-reactiveworks Have you got any solution for this?
I am also interested in this feature. @nitaliano is there another issue we can follow?
We鈥檝e had this in production for a few months. Here is our approach:
On iOS, dragable markers can be achieved by using a panResponder on top of the MapView and read panRespinder data to update a shape source. Our interaction pattern is Long Press -> drag on interactive marker.
You will also need to disable/enable scrolling on the map when the user hits a marker that is dragable.
On Android, you will not be able to pass touch events via the MapView to a panResponder (due to the way Android handles touches).
You can still implement dragable points, but the interaction model needs to be a bit different.
In this case, you鈥檒l need to listen to presses on the interactive shape source, then add an invisible view on top of the map with panResponder. From there, you can listen to drag events on the invisible view and update the underlying map data. Once the drag gesture is complete, you remove the invisible view to let the user resume interaction with the map. This approach is a bit more clunky than iOS, but it鈥檚 the best possible right now.
FYI: You will need to do a bit of transforms between screen coordinates and geographic coordinates along with a bit of state management. It can be a bit hard, but it is def. doable.
@nitaliano Any update on this one?
I am really interested in this feature. Also, if the feature is preset in native sdks but the bridging is not there, can anyone point me to any documentation on how to achieve that?
We鈥檝e had this in production for a few months. Here is our approach:
On iOS, dragable markers can be achieved by using a panResponder on top of the MapView and read panRespinder data to update a shape source. Our interaction pattern is Long Press -> drag on interactive marker.
You will also need to disable/enable scrolling on the map when the user hits a marker that is dragable.
On Android, you will not be able to pass touch events via the MapView to a panResponder (due to the way Android handles touches).
You can still implement dragable points, but the interaction model needs to be a bit different.
In this case, you鈥檒l need to listen to presses on the interactive shape source, then add an invisible view on top of the map with panResponder. From there, you can listen to drag events on the invisible view and update the underlying map data. Once the drag gesture is complete, you remove the invisible view to let the user resume interaction with the map. This approach is a bit more clunky than iOS, but it鈥檚 the best possible right now.
FYI: You will need to do a bit of transforms between screen coordinates and geographic coordinates along with a bit of state management. It can be a bit hard, but it is def. doable.
@kristfal do you have an example?
Most helpful comment
@kristfal do you have an example?