React-google-maps: Map scrolling issue in SearchBox docs example

Created on 27 Mar 2018  路  1Comment  路  Source: tomchentw/react-google-maps

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.

Most helpful comment

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PaulieScanlon picture PaulieScanlon  路  3Comments

0x1bitcrack3r picture 0x1bitcrack3r  路  3Comments

Mahmood004 picture Mahmood004  路  3Comments

craigcartmell picture craigcartmell  路  4Comments

shrimpy picture shrimpy  路  3Comments