diff --git a/src/Polygon.js b/src/Polygon.js new file mode 100644 index 00000000..c8a79e90 --- /dev/null +++ b/src/Polygon.js @@ -0,0 +1,31 @@ +import React, { Component } from "react"; +import { Polygon } from "react-google-maps"; + +class MapViewPolygon extends Component { + render() { + const { + coordinates, + fillColor, + strokeColor, + strokeWidth, + ...rest + } = this.props; + + return ( + ({ + lat: x.latitude, + lng: x.longitude, + }))} + options={{ + strokeColor: strokeColor, + strokeWeight: strokeWidth, + fillColor: fillColor, + }} + {...rest} + /> + ); + } +} + +export default MapViewPolygon; diff --git a/src/index.js b/src/index.js index dab5f226..6a8fd77c 100755 --- a/src/index.js +++ b/src/index.js @@ -4,6 +4,7 @@ import { withGoogleMap, GoogleMap } from 'react-google-maps'; import Marker from './Marker'; import Polyline from './Polyline'; import Callout from './Callout'; +import Polygon from './Polygon'; const GoogleMapContainer = withGoogleMap(props => ( @@ -102,6 +103,7 @@ class MapView extends Component { MapView.Marker = Marker; MapView.Polyline = Polyline; MapView.Callout = Callout; +MapView.Polygon = Polygon; const styles = StyleSheet.create({ container: {