Jerry Yuan
Jerry Yuan

Reputation: 765

How to Add Polygon to MapView in React Native

In Objective-C, we can use MKPolygon to add a polygon to the mapview. How can I add polygons to map view using React Native? Is it possible? I think technically it is possible. I probably need to go the source code of react native.

Upvotes: 2

Views: 2086

Answers (1)

Jay
Jay

Reputation: 1411

It might be, but the MapView that comes with React Native is lacking for Android, and it seems crippled for iOS. I only saw the overlay property, which should work for polygons, and it even has a fillColor property, which would imply that you could. However, It's not clear from the docs what to do to tell the overlay that you want a polygon instead of a polyline.

I'd suggest this much more capable replacement MapView for React Native: https://github.com/lelandrichardson/react-native-maps

I'm halfway expecting the React Native maintainers to take notice of it, and integrate it if they find out about it.

Upvotes: 1

Related Questions