-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
add Android support for onPoiClick #2050
Conversation
Great! Can you please also add an example of usage. And we'll have to rebase a little bit later it as there's another PR adding feature to the same files. So if you are going to add iOS implementation, absolutely welcome (will it be only GM specific?) |
A pleasure to collaborate ! |
Here is the example ! Let me know if it's good. There is one thing I still feel weird about, it's to have to get the I'm open to update it if there is a better way, that I didn't get yet. |
LGTM @alvelig 🐽 |
@julienR2 LGTM, one question only: what's happening if we use the apple map? |
@rborn Since the callback doesn't exist on MapKit, I implemented it only on AirGoogleMaps. Therefore if you try using onPoiClick callback on with native IOS map, nothing will happen since no listener nor callback are set. I'm wondering if it would be worth logging a warning Let me know if it's needed ! |
Thats great, and you specify in the docs it's google only so no need for the log. |
docs/mapview.md
Outdated
@@ -50,6 +50,7 @@ To access event data, you will need to use `e.nativeEvent`. For example, `onPres | |||
| `onRegionChangeComplete` | `Region` | Callback that is called once when the region changes, such as when the user is done moving the map. | |||
| `onPress` | `{ coordinate: LatLng, position: Point }` | Callback that is called when user taps on the map. | |||
| `onPanDrag` | `{ coordinate: LatLng, position: Point }` | Callback that is called when user presses and drags the map. **NOTE**: for iOS `scrollEnabled` should be set to false to trigger the event | |||
| `onPoiClick` | `{ coordinate: LatLng, position: Point, placeId: string, name: string }` | Callback that is called when user click on a POI. **NOTE**: Android only (IOS soon) |
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.
We have iOS now, right? So the soon
line can be removed
poi: null, | ||
}; | ||
|
||
this.onPoiClick = this.onPoiClick.bind(this); |
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.
If you use an arrow function the bind is not needed, but it's up to you :)
@julienR2 small comments, then we merge 🎉 |
Oups well seen 👍 I forgot to change this after implementing IOS. I'll do it immediately ! |
Awesome ! Thanks for merging it 👍 |
Exposes the onPoiClick event to react-native-maps wrapper.
It send back the location of the poi, the name and the googleId (docs updated)
I haven't dug in IOS implementation yet since I'm more confortable with android. But I'll definitely do it through a next PR ! (or if anyone is keen to, feel free)
Let me know if any other steps need to be done 👍