react-google-maps icon indicating copy to clipboard operation
react-google-maps copied to clipboard

Accessing google.maps.Map Object, yet another case

Open deflexor opened this issue 10 years ago • 2 comments

For example i has one component <MyMap/>, which contains <GoogleMap/>. And now i need another component <PlaceFineder/> which uses google.maps.places.PlacesService which requires google.maps.Map object. So is there possibility to pass google.maps.Map from <MyMap/> component to <PlaceFineder/> component ? Something like:

<MyMap ref="mymap" />
...
<PlaceFinder map={this.refsmymap.props.map} />

this although should work, but not applicable in my case, is there another way ?

deflexor avatar Apr 05 '16 10:04 deflexor

If you need a reference of map object, You can try like this: ref={googleMap => { if (!googleMap) { return ; } console.log(googleMap); this.gmap = googleMap; } } this.gmap.props.map will give you the reference to map .

indurnath avatar Apr 11 '16 15:04 indurnath

We're going to look into this shortly.

We're also looking for maintainers. Involve in #266 to help strengthen our community!

tomchentw avatar May 29 '16 03:05 tomchentw