You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: On Android, onLongPress function is working only once(initial render) #3715
run npx patch-package to patch the rnmapbox package.
add the following script to package.json to make patch-package run in EAS builds: "eas-build-post-install": "patch-package"
Of course, this does not solve the problem, just downgrades the mapbox version to one that works, while keeping up with other fixes in this repo. At some point downgrading the version will break the library, but for now it works.
Yeah, like others are noticing, this is coming from the Mapbox Android SDK. One work around is to use react-native-gesture-handler and wrap the map view in a gesture detector:
import { Gesture, GestureDetector } from 'react-native-gesture-handler'
const longPressGesture = Gesture.LongPress()
.enabled(Platform.OS === "android")
.runOnJS(true)
.onStart(async e => {
if (e) {
const mapPoint = await mapRef.getCoordinateFromView([e.x, e.y])
if (mapPoint) {
... do something with point
}
}
})
return (
<GestureDetector gesture={longPressGesture}>
<View style={{ flex: 1 }} collapsable={false}>
<Mapbox.MapView
ref={mapRef}
onLongPress={Platform.OS === "android" ? undefined : onMapLongPress}
/>
</View>
</GestureDetector>
)
This appears to be resolved in recent versions. The root cause was in the Mapbox Android SDK (introduced around 10.18.4), and has been fixed in the newer SDK versions that @rnmapbox/maps now depends on.
Two commenters confirmed it works correctly on 10.2.10, and the current release (10.3.0-beta) uses MapboxMaps 11.18.x which also doesn't have this issue.
Closing — please reopen if anyone is still seeing this on a current version.
Activity
youtipie commentedon Dec 9, 2024
+1
bitkraft-ssheikh commentedon Dec 12, 2024
I am facing the same issue.
jayjo34 commentedon Dec 19, 2024
Mee too
prashantsail commentedon Dec 23, 2024
I am running into this issue as well. Is there a workaround available ?
yashp1998 commentedon Dec 23, 2024
I am facing same issue
MykytaShchukin commentedon Jan 9, 2025
Also have this issue. Any solutions?
build(Packages): Minor and patch updates
smartmedev commentedon Jan 17, 2025
same issue for me. Any solutions??
7 remaining items
vigor-13 commentedon Mar 31, 2025
Same issue on 10.1.37
SsankQ commentedon Mar 31, 2025
Same issue on 10.1.37
ShahilMangroliya commentedon Mar 31, 2025
Same issue on 10.1.37
cyburns commentedon Apr 16, 2025
Any update on this issue?
ShahilMangroliya commentedon Apr 17, 2025
If you change def defaultMapboxMapsVersion = "10.18.0" in build.gradle of the this lib then its working
vegtelenseg commentedon Apr 19, 2025
Not sure if this will work for others, but I had to use a newer version of mapbox.
deathook007 commentedon Apr 28, 2025
Any workaround found here??
dominikjambor commentedon Apr 28, 2025
@deathook007 Here's my complete workaround by locally patching the previously suggested version:
My rnmapbox version at the moment is:
"@rnmapbox/maps": "10.1.37",(this is important for the patch definition)npm i patch-packagepatches/@rnmapbox+maps+10.1.37.patchwith the following content:`npx patch-packageto patch the rnmapbox package."eas-build-post-install": "patch-package"Of course, this does not solve the problem, just downgrades the mapbox version to one that works, while keeping up with other fixes in this repo. At some point downgrading the version will break the library, but for now it works.
Hope this helps.
udaysagartammina commentedon Aug 18, 2025
I’m also facing the same issue. Did anyone find a fix for this issue?
"@rnmapbox/maps": "^10.1.41",
Thanks in advance.
ourdudekyle commentedon Aug 18, 2025
Yeah, like others are noticing, this is coming from the Mapbox Android SDK. One work around is to use
react-native-gesture-handlerand wrap the map view in a gesture detector:rawcomposition commentedon Jan 12, 2026
Just ran into this same issue and was disappointed that there isn't really a solution over a year later 😔
dominikjambor commentedon Jan 13, 2026
@rawcomposition I don't have the problem anymore in 10.2.10 . Which version are you on?
rawcomposition commentedon Jan 14, 2026
You're right! I had forgotten to do a full rebuild after testing the latest version. Long press does indeed work as expected now on 10.2.10!
mfazekas commentedon Mar 1, 2026
This appears to be resolved in recent versions. The root cause was in the Mapbox Android SDK (introduced around 10.18.4), and has been fixed in the newer SDK versions that
@rnmapbox/mapsnow depends on.Two commenters confirmed it works correctly on 10.2.10, and the current release (10.3.0-beta) uses MapboxMaps 11.18.x which also doesn't have this issue.
Closing — please reopen if anyone is still seeing this on a current version.