react-google-map-components
Declarative React Google Map Components.
Installation
With yarn:
yarn add react-google-map-components
With npm:
npm install --save react-google-map-components
WIP Alert
Not all Google Map components are ported (See #1).
Usage
;;; Component state = step: 0 ; { const step = thisstate; const maps path style center = thisprops; return <GoogleMap zoom=9 maps=maps style=style center=center> <ZoomControl /> <FitBounds latLngBounds=path /> <Polyline path=path strokeOpacity=03 /> <CustomControl position="BOTTOM_CENTER"> step === 0 ? <button onClick= this> Start </button> : <button onClick= this>Revert</button> </CustomControl> <Motion defaultStyle= position: 0 style= position: > <Polyline path=path /> </Motion> </GoogleMap> ; }
Check documentation page for more examples.
Touch Events not working?
if windownavigator /** * Make mouse work with google maps in Windows touch devices. * * @link http://stackoverflow.com/a/37611736/1709679 */ windownavigatormsPointerEnabled = true; /** * Make touch/pan/zoom work with google maps work in Windows touch devices. * * @link https://code.google.com/p/gmaps-api-issues/issues/detail?id=6425 */ windownavigatormsMaxTouchPoints = windownavigatormsMaxTouchPoints || 2;
Minimizing Bundle Size
If you're bundling your app with Rollup or webpack and don't want to manually chery pick modules you're using, you can use babel plugin that will do it for you.
Related Projects
- https://github.com/istarkov/google-map-react
- https://github.com/tomchentw/react-google-maps
- https://github.com/googlemaps/v3-utility-library
Licence
MIT