-
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 gradient/multi-color polyline support for iOS (MapKit) #1911
Add gradient/multi-color polyline support for iOS (MapKit) #1911
Conversation
LGTM. As far as I can see there is not any drawback in replacing MKPolygonRenderer with MKOverlayPathRenderer, is it? Great present BTW :) With all the bells and whistles! |
That’s right. And to be on the safe side, I enabled the new polyline renderer only when ‘strokeLines’ is used for now. |
- (void) addPoint:(CGPoint)point color:(UIColor*)color; | ||
@property UIColor *color; | ||
@property CGMutablePathRef path; | ||
@property UIColor *color2; |
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.
can we find a better name for color2
?
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.
Good catch. You're right, it would have been better to name these startColor
and endColor
, because this is exactly what they are. I'll make the changes.
Please wait a bit with merging this, I'm seeing an occasional rendering issue with certain zoom scales |
Alright, rendering issues seem resolved now 👍 |
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.
LGTM
@alvelig @christopherdro 🐽
if all ok should we push to npm ? Thanks
LGTM |
Hi guys, it's Christmas so it's time for presents 🎁
This PR adds support for gradient/multi-color Polylines for iOS/MapKit.
It adds a prop called
strokeColors
to<Polyline>
which should be an array of colors, and which should have the same length as thecoordinates
prop. If two colors are different, it will then draw a gradient between those two coordinates. In order to create "smoother" gradients, you can also create "holes" in the color-array, be specifying#00000000
. This will then draw a path using a linear gradient between the coordinates for which a color was defined.Example:
I've updated the docs and the MapExplorer as well.
Hopefully I can Android support for it too soon.
cheers,
Hein