Skip to content

Stop marker event propagation in order to prevent onPress for MapView…#2068

Merged
rborn merged 2 commits intoreact-native-maps:masterfrom
hysan:master
Mar 10, 2018
Merged

Stop marker event propagation in order to prevent onPress for MapView…#2068
rborn merged 2 commits intoreact-native-maps:masterfrom
hysan:master

Conversation

@hysan
Copy link
Contributor

@hysan hysan commented Mar 7, 2018

Stop marker event propagation in order to prevent onPress for MapViews from being called when a marker is clicked. This makes the behavior of Apple Maps identical to that of the behavior of Google Maps on Android. This fixes #1132.

Is there any other PR opened that does the same ?

No, not that I've seen. Nothing is referenced in any of the issues I've come across either.

What issue is this PR fixing

#1132

…s from being called when a marker is clicked. This makes the behavior of Apple Maps identical to that of the behavior of Google Maps on Android. This fixes react-native-maps#1132.
@rborn
Copy link
Collaborator

rborn commented Mar 8, 2018

LGTM @alvelig 🐽

@alvelig
Copy link
Contributor

alvelig commented Mar 8, 2018

@hysan you yourself say that it would be a switchable adjustment with a prop... Let's be consistent for this behavior and I suggest keeping propagation by default but make it configurable with a prop stopPropagation={true}.

@hysan
Copy link
Contributor Author

hysan commented Mar 8, 2018

@alvelig Ok, so add a stopPropagation prop and default it to false + update the Marker docs? How much explanation should I put into the docs?

@alvelig
Copy link
Contributor

alvelig commented Mar 8, 2018

As much as you wish. You may just reference your comment in the issue with short comments. That will do.

…to control whether or not onPress events from Markers propagate up and trigger MapView onPress events. This is iOS only. The default behavior is disabled (false) to prevent a breaking change from the current behavior.
@hysan
Copy link
Contributor Author

hysan commented Mar 9, 2018

Done, but I'm not familiar with TypeScript so all I did was copy paste. Also, I could have not defined defaultProps and just relied on undefined being falsy, but I wasn't sure if that was idiomatic or not. Someone should double check. Thanks.

@alvelig
Copy link
Contributor

alvelig commented Mar 9, 2018

LGTM

@rborn rborn merged commit f8e9253 into react-native-maps:master Mar 10, 2018
pinpong pushed a commit to pinpong/react-native-maps that referenced this pull request Feb 28, 2025
react-native-maps#2068)

* Stop marker event propagation in order to prevent onPress for MapViews from being called when a marker is clicked. This makes the behavior of Apple Maps identical to that of the behavior of Google Maps on Android. This fixes react-native-maps#1132.

* Added a new Marker prop called stopPropagation. This allows the user to control whether or not onPress events from Markers propagate up and trigger MapView onPress events. This is iOS only. The default behavior is disabled (false) to prevent a breaking change from the current behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IOS OnMapPress called when press the marker

3 participants