-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(AIRGoogleMapsMarker): add onSelect/onDeselect support fo google maps #4990
feat(AIRGoogleMapsMarker): add onSelect/onDeselect support fo google maps #4990
Conversation
Wow! i was looking for this functionality, and you just pushed it 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks and works fine on iOS simulator and Android device. I'm just thinking if second press on the same marker shouldn't be considered as deselect on iOS. It works like that on Android though.
Thanks @mateki0 good catch! I've tweaked the google maps implementation to match the mapkit one's. The mapkit implementation is the original one and is implemented by mapkit itself. So no it should be impossible to deselect a marker by clicking on it multiple times. Also I've added the onMarkerSelect and onMarkerDeselect functionality since its related |
@jan-kozinski the code looks good, but I have a small feedback I wouldn't change the AIRGoogleMapMarker.m eventFromMarker AIRGMSMarker.m for some reason that class was left empty all the history of the repo, I would simply keep the same tradition. instead just modify the function in AIRGoogleMapMarker to accept action as a parameter, for example:
finally, In general I would avoid adding anything to the .h files, because that implies new public interfaces / functionality ... I don't see the need for such APIs most of the time, rather the body of a class (.m file) can manage the state internally and propagate the events correctly as you can see. |
Hi @salah-ghanim thanks for the feedback. I've added the makeEventData to the AIRGMSMarker, because selectedMarker in AIRGoogleMap must ba an instance of GSMMarker (it can't be a AIRGoogleMapMarker because the |
Also thanks for the advice with .h files, I've removed as many public interfaces as possible. Removing them further causes the code to not compile, so you can take a second look when you got time @salah-ghanim . |
# [1.12.0](v1.11.3...v1.12.0) (2024-03-29) ### Features * **google-maps:** add onSelect/onDeselect support fo google maps ([#4990](#4990)) ([b9fbe31](b9fbe31))
🎉 This PR is included in version 1.12.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [1.12.0](react-native-maps/react-native-maps@v1.11.3...v1.12.0) (2024-03-29) ### Features * **google-maps:** add onSelect/onDeselect support fo google maps ([#4990](react-native-maps/react-native-maps#4990)) ([b9fbe31](react-native-maps/react-native-maps@b9fbe31))
# [1.12.0](react-native-maps/react-native-maps@v1.11.3...v1.12.0) (2024-03-29) ### Features * **google-maps:** add onSelect/onDeselect support fo google maps ([#4990](react-native-maps/react-native-maps#4990)) ([b9fbe31](react-native-maps/react-native-maps@b9fbe31))
# [1.12.0](react-native-maps/react-native-maps@v1.11.3...v1.12.0) (2024-03-29) ### Features * **google-maps:** add onSelect/onDeselect support fo google maps ([#4990](react-native-maps/react-native-maps#4990)) ([b9fbe31](react-native-maps/react-native-maps@b9fbe31))
Does any other open PR do the same thing?
no
What issue is this PR fixing?
#4970
#114
How did you test this PR?
andoid emulator & ios simulator