Skip to content
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

Added support for drawing polylines on snapshots on iOS #615

Merged

Conversation

IjzerenHein
Copy link
Contributor

@IjzerenHein IjzerenHein commented Sep 26, 2016

This pull request fixes the issue that polylines are not drawn on snapshots on iOS.

Specifically, it adds infrastructure (the AIRMapSnapshot protocol) to which overlays can conform. The AIRMapSnapshot protocol has one method called drawToSnapshot which can optionally be implemented by overlays.

Additionally, this pull request adds the drawToSnapshot implementation for the AIRMapPolyline class, causing it to be rendered to snapshots. It should be fairly easy to extends other overlays to support snapshot drawing as well.

The example below shows the image that was generated using the takeSnapshot function, including the polyline overlay:

image

@spikebrehm
Copy link

Nice, thanks!

@spikebrehm spikebrehm merged commit 4958091 into react-native-maps:master Sep 27, 2016
@IjzerenHein
Copy link
Contributor Author

Awesome, thanks for pulling!

FYI, I'm working on the Android implementation of taking snapshots. I'll hopefully push that soon.

@jeveloper
Copy link

Thanks @IjzerenHein !

Any chance you can provide an example?
Is that something end user can drag and it draws a line or you pass an array of x,y and it draws lines ?

thanks

@IjzerenHein
Copy link
Contributor Author

@jeveloper Serge, no you have to add <Polyline ... /> as a child of <MapView> and then you can call takeSnapshot to render the map & polyline to an image. The documentation for Polyline and takeSnapshot is in the main README.

cheers

@jeveloper
Copy link

thanks for sharing that info :)

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.

3 participants