react-scrolllock icon indicating copy to clipboard operation
react-scrolllock copied to clipboard

On mobile, scrolling locked even within modal

Open dancherb opened this issue 5 years ago • 3 comments

When putting the <TouchScrollable> element on my page in any form, the following errors call:

this.scrollableArea.addEventListener is not a function this.scrollableArea.removeEventListener is not a function

I'm using it as the docs suggest, in a modal component:

<div>
          <TouchScrollable>
                <View>
                            {p.children}
                 </View>
           /TouchScrollable>
</div>

What I'm trying to achieve: currently the scroll lock works great on standard web by just including <ScrollLock/> when necessary on my root screen. As suggested by the docs, it's not playing well on mobile - even the modals become locked from touch scrolling.

Update: seems like the error only occurs when you use a custom child component (i.e. View) - div doesn't cause the error. However, touch scrolling is still locked in the modal when it shouldn't be (standard mouse scrolling in Chrome simulator, and on desktop browsers, still works fine).

dancherb avatar Nov 09 '20 03:11 dancherb

It seems like this isn't related to <ScrollLock/> - just putting any elements inside <TouchScrollable> prevents their scrolling on mobile, without a <ScrollLock/> anywhere in the document or project.

dancherb avatar Nov 09 '20 03:11 dancherb

I have the same issue

Lukavyi avatar Nov 09 '20 14:11 Lukavyi

They stopped the repairs. I had to do it myself, in the same way, with a new version of typeScript. And fix these problems for everyone to use. add react hooks、vue3 example

npm i body-scroll-lock-upgrade

repair log,Refer to the releases page. @Lukavyi @dancherb

rick-liruixin avatar Dec 01 '23 14:12 rick-liruixin