Skip to content

Instantly share code, notes, and snippets.

@ghoshabhi
Created June 13, 2017 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghoshabhi/b714bde7732df7c26df120b6348b4039 to your computer and use it in GitHub Desktop.
Save ghoshabhi/b714bde7732df7c26df120b6348b4039 to your computer and use it in GitHub Desktop.
import React from 'react';
import PropTypes from 'prop-types';
import GoogleMap from 'google-map-react';
import Section from 'grommet/components/Section';
const Map = ({ center, zoom, onBoundsChange, onMapLoaded }) => (
<Section pad="none" style={{ height: '500px' }}>
<GoogleMap
center={center}
zoom={zoom}
onGoogleApiLoaded={onMapLoaded}
onBoundsChange={onBoundsChange}
yesIWantToUseGoogleMapApiInternals
/>
</Section>
);
Map.defaultProps = {
center: {
lat: 30.267,
lng: -97.743,
},
};
Map.propTypes = {
onBoundsChange: PropTypes.func.isRequired,
onMapLoaded: PropTypes.func.isRequired,
center: PropTypes.shape({
lat: PropTypes.number.isRequired,
lng: PropTypes.number.isRequired,
}).isRequired,
zoom: PropTypes.number.isRequired,
};
export default Map;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment