react-native-maps: onPress and onCalloutPress doesn't trigger on markers in iOS
Here is my code:
render() {
return (
<MapView style={styles.mapView} region={this.state.region}>
<MapView.Marker
coordinate={{latitude: 45, longitude: -75}}
onSelect={this.markerPressed}
/>
</MapView>
)
}
markerPressed(){
console.log("MarkerPressed");
}
The function is being called if I use onSelect or onDeselect, but not onPress or onCalloutPress. Is this an issue with something I am doing or a bug?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 12
- Comments: 29 (2 by maintainers)
Commits related to this issue
- Merge pull request #954 from RajkumarPunchh/Collout-onPress-fix Fixed issue #286. — committed to react-native-maps/react-native-maps by deleted user 7 years ago
You can fix the onPress issue by setting a width and height for the style of the marker.
as onSelect only works on ios and onPress only works on android i’m using both as a work around <MapView.Marker
onSelect={markerClickHandler} onPress={markerClickHandler} >
+1, onPress, onCalloutPress does not work for iOS.
Fixed by #954
@RajkumarPunchh I can confirm that your commit has fixed the issue in my project - onCalloutPress behaves as expected. Thanks!
@gmarinosyan Did you guys already try the most recent release 0.6.0?