-
Notifications
You must be signed in to change notification settings - Fork 936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use getCenter function and others #466
Comments
Please refer to Getting Help section in the README (or #469). |
Breaking change in 6.0.0.
https://github.com/tomchentw/react-google-maps/blob/master/CHANGELOG.md#600-2016-10-04
…On Wed, Apr 26, 2017 at 12:56 AM David Vaini ***@***.***> wrote:
you would figure basic usage would be covered under the documentation.
There seems to be no mention of the switch from refs to whatever it
currently uses:
In the change log it doesnt mention the change from ref="map" to
ref={props.onMapLoad}
considering all previous ways of calling functions like getCenter() used
ref.map.getCenter() it breaks existing code. Then when you try to set the
ref, you get "Stateless function components cannot have refs."
so they got rid of refs entirely? This question has been asked on
stackoverflow but considering there is no documentation for this change,
there is no good answer yet on how to do basic map handling. I will be
digging through the source code to figure it out... ugh.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#466 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA4SemMPtg4lP01eJ9lPyRa9cfjvXukhks5rziW_gaJpZM4NBX9n>
.
|
It's defined in the public method of the |
Can anyone explain how to properly access the refs and how to subsequently call a function off of it per DavidVaini's question above? |
here's a nice example from official documentation |
none of these examples are working? |
I am trying to get the center info by clicking on a button but when using this.refs.map.getCenter() i am getting the error of can not find property getCenter of undefined? |
You need to store |
This is how I'm trying to use getCenter using a ref, and it's not working.
|
@Darksoulsong this repo is unmaintained more than a year, please refer to npm @react-google-maps/api |
How can I use getCenter?
I try
<GoogleMap
defaultZoom={14}
center={{lat: props.mapCenter.lat, lng: props.mapCenter.lng}}
onCenterChanged={getCenter()}
But I get message getCenter is undefined
The text was updated successfully, but these errors were encountered: