Skip to content
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

Map ignores zoom/center state changes after user pans map with built-in controls #176

Closed
worldlyjohn opened this issue Jun 23, 2016 · 2 comments

Comments

@worldlyjohn
Copy link

I have a basic map example with a button that on click will change map zoom and center. The button works as intended on load.

However, once you pan the map or use the built-in zoom controls the map stops listening to the state events. When you try the button event after zooming in with controls, the map fails to respond and update.

Anyone else experience this? Some sample code to reproduce is below...

handleClick() {
  this.setState(update(this.state, {
    zoom: 12,
    center: {lat: 44, lng: 13}
  }));
},
render() {
  <div onClick={this.handleClick}>re-zoom</div>
  <GoogleMap
    center={this.state.center}
    zoom={this.state.zoom}>
  </GoogleMap>
}

@istarkov
Copy link
Collaborator

Please provide jsbin examples https://jsbin.com/roqutisoqu/1/edit?js,console,output
Otherwise I have no idea how to help with information u provide.

@worldlyjohn
Copy link
Author

ahh, thank you. looks like i need to capture the onChange and set state from those changes as well, otherwise it stops working.

that said, now im seeing more of the problems with "GoogleMap bounds not eq" referenced by google-map-react/old-examples#8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants