Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 28476

TouchableOpacity onLongPress not working on android

$
0
0

i have been trying to use a TouchableOpacity inside a react-native-mapsMarker heres the code:

<MapView.Marker
     coordinate={{
     latitude: marker.lat,
     longitude: marker.lng
     }}
     anchor={{ x: 0, y: 0 }}
     centerOffset={{ x: 0, y: 0 }}
     calloutOffset={{ x: 0, y: 0}}
     title={marker.title}
     description="Sample Description">
<TouchableOpacity
     onLongPress={() => {console.log("MARKER LONG PRESSED")}}
     delayLongPress={1000}
     onPress={()=>{console.log("MARKER PRESSED")}}
>
     // here i have a custom image for the marker
</TouchableOpacity>
</MapView.Marker>

now the problem is this works fine on ios both the onPress and onLongPress events get invoked but on android none of them gets called this is so confusing and i dont know why. is there something i am missing here or something i should be adding?

and also i am importing ToucahbleOpacity from react-native-gesture-handler. i tried importing it from react-native but that just doesnt work on both platforms


Viewing all articles
Browse latest Browse all 28476

Trending Articles