-
Notifications
You must be signed in to change notification settings - Fork 314
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
On Center Change Issues #8
Comments
As I see two different setState occurs, may be this is the problem import { unstable_batchedUpdates } from 'react-dom'; // eslint-disable-line
|
Also If you use |
Simplifying the example I see similar error messages. First I removed controllable. Then, I changed onChange to just call forceUpate. _onChange({center, zoom, bounds, ...other}) {
this.forceUpdate();
} I have also tried it with unstable_batchedUpdates(); The error I see now is: "google_map.js:697 GoogleMap bounds not eq: |
Have no such issue. Have fully controllable zoom an center in my projects and in a part of this examples. You can place anywhere the minimal example with this error. |
Here is working jsbin with latest GoogleMapReact version, could you show the bug there? |
Hi, Thanks for the example! If you use the same example but change setState to _onChange = ({center, zoom}) => { |
It is normal behavior. As like as I want. Why you need forceUpdate here? |
Force update was my attempt to pinpoint why the following was giving me error:
I am new, so it is very likely my understanding of acceptable flow is wrong. On an update event, why shouldn't it be able to force a rerender right away? |
You can force rerender if you set zoom and center. Google API is not declarative, So you can or set zoom and center as like as in example. |
Here is simple example with other situation but it give you an idea how is to work with third party api https://jsbin.com/jadefenuza/edit?js,console,output All looks nice until you try to change input anywhere inside, |
Thanks for the explanation and examples! |
So the problem I am trying to solve is when I change zoom/center on the map, it update my reflux store so other components can filter on it. Similarly, when other components change these in the reflux store the map itself will update. I can see it's similar to, but the loop I implicitly create causes issues: Do you have any recommended approach? |
The same approach as in jsbin example |
Finally got it working! At the end, I was seeing that message because although data was changing, I had a typo in my connector so my zoom/center were not getting updated in the redux store and instead cycling in the default value. Thank you for your help. This project and the examples are amazing. |
I'm trying to control map boundaries through state and get this error GoogleMap bounds not eq.
|
If u close console, does your code works? Is your problem in warning message only? |
Yes it brings the center back if it exceedes the bounds, but zoom level stays the same, not changing back to minZoomLevel |
@fruitkiwi Found this issue will work at today. |
I'm getting this
causes the warnings to occur. I'm using mobx but don't think that's related. These warnings are not just cosmetic - I've got a bug where the map just zooms back and forth forever by itself, but while trying to debug it I noticed that even this simple case gives warnings. I'm on version 0.14.4. |
I can confirm that the test() {
console.log('foo');
}
<GoogleMap onChange={this.test}> Mobx isn't the reason, I'm using Redux with SSR, for example. If i remove |
I'm seeing the same problem. Only happening when I change zoom AND center. Changing center by itself doesn't throw the "bounds not eq" error. Confused, bc the bounds should have changed if zoom and center change. |
Hi @istarkov : I am facing some rendering issue. Need your help, can you please tell me how can i refresh the map. I need to refresh map because in my case i am resizing wrapper so it doesn't render to the new height. |
Hi Guys, N00bie here and I am having issue triggering the re-centring of the map using the onChildClick option of the GoogleMap element:
This is my _onChildClick function:
This does nothing even though I have confirmed that the childProps values are correct. I experimented with using states, i.e.:
Zoom works but the map remains on the original center value and this can be done only once. Im not sure if this was answered before, but reading through the comments it seems this is not issuing that is being reported even though the title seems to suggest this problem. Any ideas as how to get this working ? |
I faced the same issue and the easiest solution is to remove the element and then add it back. You can set showMap state flag to false and then using setTimeout(()=>{ me.setState({showMap:true},200)} Works like charm. Maybe not the best UX but not that bad either |
Hi,
Whenever I zoom, I have onChange to update my zoom which should change my makers. Instead I am seeing only the map zoom and my markers not change. The console has the following the following error output (note: react 0.14). I have found it also will not ever re-render if I change the center - so for now I have put in center to be some static value.
google_map.js:691 GoogleMap center not eq: [39.73953411213935, -104.98888952907988] [39.739336111111115, -104.99163611111113]
Thanks in advance for your suggestions!
Marc
The text was updated successfully, but these errors were encountered: