tomchentw / react-google-maps

React.js Google Maps integration component
https://tomchentw.github.io/react-google-maps/
MIT License
4.62k stars 939 forks source link

Map scrolling issue in SearchBox docs example #815

Open nickeday opened 6 years ago

nickeday commented 6 years ago

In the example at https://tomchentw.github.io/react-google-maps/#searchbox, it looks like there's a problem with scrolling the map that isn't present in any of the other examples. Scrolling will stop abruptly after a short distance at each attempt.

ping4tucker commented 6 years ago

I think it's because the onBoundsChanged is setting the bounds and center state of the map, so after setState is called in the onBoundsChange event, the map adjusts to its new center/bounds and you lose dragging (onBoundsChange gets called very quickly after the bounds change). If you switch it out for the onIdle event, it'll be smooth, because it waits for user dragging to finish and then sets the map's center/bounds state.