@syncromatics/react-google-maps
Version:
React.js Google Maps integration component
54 lines (50 loc) • 1.46 kB
Markdown
### Map with a DrawingManager
```jsx
const { compose, withProps } = require("recompose");
const {
withScriptjs,
withGoogleMap,
GoogleMap,
} = require("@syncromatics/react-google-maps");
const { DrawingManager } = require("@syncromatics/react-google-maps/lib/components/drawing/DrawingManager");
const MapWithADrawingManager = compose(
withProps({
googleMapURL: GOOGLE_MAP_URL,
loadingElement: <div style={{ height: `100%` }} />,
containerElement: <div style={{ height: `400px` }} />,
mapElement: <div style={{ height: `100%` }} />,
}),
withScriptjs,
withGoogleMap
)(props =>
<GoogleMap
defaultZoom={8}
defaultCenter={new google.maps.LatLng(-34.397, 150.644)}
>
<DrawingManager
defaultDrawingMode={google.maps.drawing.OverlayType.CIRCLE}
defaultOptions={{
drawingControl: true,
drawingControlOptions: {
position: google.maps.ControlPosition.TOP_CENTER,
drawingModes: [
google.maps.drawing.OverlayType.CIRCLE,
google.maps.drawing.OverlayType.POLYGON,
google.maps.drawing.OverlayType.POLYLINE,
google.maps.drawing.OverlayType.RECTANGLE,
],
},
circleOptions: {
fillColor: `#ffff00`,
fillOpacity: 1,
strokeWeight: 5,
clickable: false,
editable: true,
zIndex: 1,
},
}}
/>
</GoogleMap>
);
<MapWithADrawingManager />
```