You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ compose, withProps, withStateHandlers }=require("recompose");constFaAnchor=require("react-icons/lib/fa/anchor");const{
withScriptjs,
withGoogleMap,
GoogleMap,
OverlayView,}=require("react-google-maps");constgetPixelPositionOffset=(width,height)=>({x: -(width/2),y: -(height/2),})constMapWithAnOverlayView=compose(withStateHandlers(()=>({count: 0,}),{onClick: ({ count })=>()=>({count: count+1,})}),withScriptjs,withGoogleMap)(props=><GoogleMapdefaultZoom={8}defaultCenter={{lat: -34.397,lng: 150.644}}><OverlayViewposition={{lat: -34.397,lng: 150.644}}/* * An alternative to specifying position is specifying bounds. * bounds can either be an instance of google.maps.LatLngBounds * or an object in the following format: * bounds={{ * ne: { lat: 62.400471, lng: -150.005608 }, * sw: { lat: 62.281819, lng: -150.287132 } * }} *//* * 1. Specify the pane the OverlayView will be rendered to. For * mouse interactivity, use `OverlayView.OVERLAY_MOUSE_TARGET`. * Defaults to `OverlayView.OVERLAY_LAYER`. */mapPaneName={OverlayView.OVERLAY_MOUSE_TARGET}/* * 2. Tweak the OverlayView's pixel position. In this case, we're * centering the content. */getPixelPositionOffset={getPixelPositionOffset}/* * 3. Create OverlayView content using standard React components. */><divstyle={{background: `white`,border: `1px solid #ccc`,padding: 15}}><h1>OverlayView</h1><buttononClick={props.onClick}style={{height: 60}}>
I have been clicked {props.count} time{props.count>1 ? `s` : ``}</button></div></OverlayView></GoogleMap>);<MapWithAnOverlayViewgoogleMapURL="https://maps.googleapis.com/maps/api/js?key=AIzaSyDDe44e1ctJvBUEKGeHp9TbuulZ0C6Dh0A&v=3.exp&libraries=geometry,drawing,places"loadingElement={<divstyle={{height: `100%`}}/>}containerElement={<divstyle={{height: `400px`}}/>}mapElement={<divstyle={{height: `100%`}}/>}/>