React-map-gl: Can't scroll on mobile devices when scrolling on map

Created on 20 Apr 2018  路  8Comments  路  Source: visgl/react-map-gl

Facing an issue where on a mobile device if I am scrolling down the page, and I start the scroll touch on the map, it won't let me scroll anymore. Even with all the capture events disabled. I recreated the problem in a sandbox environment: https://codesandbox.io/s/rx0r2y7yo

If you go to the browser with that code, and in the chrome dev tools simulate a mobile device, and try to scroll down the page, starting the touch on the map itself.

Any insight would be great! Thanks.

Most helpful comment

Published 3.2.9

Use

<MapGL ... dragPan={false} touchAction="pan-y" />

to enable vertical scroll on mobile.

See updated documentation

All 8 comments

capture* props only apply to overlay components and not the map component.

My first instinct was that you also need to disable dragRotate to disable the gesture altogether, but that doesn't seem to do the trick.

Under the hood we use hammer.js to handle gestures. Somewhere in the implementation it is conflicting with the browser's default touch actions. I will investigate.

Ah, gotcha.

Thanks @Pessimistress ... I am also looking into it as well but look forward to hearing your response.

Any updates on this @Pessimistress? I haven't had the chance to really dive into it, but if there is any further knowledge transfer on this particular issue in debugging it ... that would be greatly appreciated! Thanks.

+1

FWIW, it might be related to setting touch-action: none; on the parent element. I find I can scroll fine while still being able to do things like pinch zoom if I set touch-action: pan-y on the outer map div.

A more official workaround would be quite welcome, though!

@aendrew Thanks for the tip. I'll get something out this week.

Published 3.2.9

Use

<MapGL ... dragPan={false} touchAction="pan-y" />

to enable vertical scroll on mobile.

See updated documentation

Thanks @Pessimistress!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nip10 picture nip10  路  4Comments

tbergman picture tbergman  路  3Comments

bogdancaspar picture bogdancaspar  路  3Comments

sudoStatus200 picture sudoStatus200  路  5Comments

joseomar10 picture joseomar10  路  5Comments