This lib is ruined by the author's fetish for recompose
See original GitHub issueIn what universe is this a good way to write components?
compose(
withProps({
googleMapURL: "https://maps.googleapis.com/maps/api/js?key=AIzaSyC4R6AN7SmujjPUIGKdyao2Kqitzr1kiRg&v=3.exp&libraries=geometry,drawing,places",
loadingElement: <div style={{ height: `100%` }} />,
containerElement: <div style={{ height: `400px` }} />,
mapElement: <div style={{ height: `100%` }} />,
}),
lifecycle({
componentWillMount() {
const refs = {}
this.setState({
bounds: null,
center: {
lat: 41.9, lng: -87.624
},
markers: [],
onMapMounted: ref => {
refs.map = ref;
},
onBoundsChanged: () => {
this.setState({
bounds: refs.map.getBounds(),
center: refs.map.getCenter(),
})
},
onSearchBoxMounted: ref => {
refs.searchBox = ref;
},
onPlacesChanged: () => {
const places = refs.searchBox.getPlaces();
const bounds = new google.maps.LatLngBounds();
places.forEach(place => {
if (place.geometry.viewport) {
bounds.union(place.geometry.viewport)
} else {
bounds.extend(place.geometry.location)
}
});
const nextMarkers = places.map(place => ({
position: place.geometry.location,
}));
const nextCenter = _.get(nextMarkers, '0.position', this.state.center);
this.setState({
center: nextCenter,
markers: nextMarkers,
});
// refs.map.fitBounds(bounds);
},
})
},
}),
withScriptjs,
withGoogleMap
)(props =>
<GoogleMap
ref={props.onMapMounted}
defaultZoom={15}
center={props.center}
onBoundsChanged={props.onBoundsChanged}
>
Issue Analytics
- State:
- Created 5 years ago
- Reactions:61
- Comments:21
Top Results From Across the Web
The writer's barely disguised fetish | Alien: Isolation - YouTube
What a stupid endingYes, this will be a Completely Accurate SummaryWanna play with us?Discord: https://discord.gg/e95T48YEnjoying the ...
Read more >The Hand of the Poet: The Magical Value of Manuscripts
Libraries announce the acquisition of a famous writer's papers with the same blare of publicity that accompanies a medical breakthrough. The public.
Read more >Dialogues between Canada and the American South
Negroes (2007), by the Canadian mixed-race writer Lawrence Hill, the son of American immigrants to Canada. Haley's particular brand of cultural na-.
Read more >Radio, Narrative, and the New Neighborhood of the Americas ...
I bring together this new neighborhood of writers who latch on to the long legacy of sound technology's resistance to legal concepts of...
Read more >Journal of the Short Story in English, 69
Jay Ruud studies a more recent author, Tim O'Brien, affected by the Vietnam War and ... The shock that Sun feels at the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@justrossthings could you please elaborate what you’re hoping for when opening an issue like this?
Taken from the docs