Temzasse / react-modal-sheet

Flexible bottom sheet component built with Framer Motion to provide buttery smooth UX while keeping accessibility in mind 🪐
https://temzasse.github.io/react-modal-sheet/
MIT License
783 stars 74 forks source link

Scroll flickering on iOS with Sheet.Scroller & inputs #140

Closed mleister97 closed 9 months ago

mleister97 commented 9 months ago

When the keyboard opens, the whole page is flickering when i try to scroll the content of the scroller. Is this related to pull request https://github.com/Temzasse/react-modal-sheet/pull/138?

Code:

<Sheet
  isOpen={true}
  disableDrag={true}
  detent="full-height"
  snapPoints={[0.75]}
  onClose={() => {}}
>
  <Sheet.Container>
    <Sheet.Content>
      <Sheet.Scroller >
        Some text & inputs
      </Sheet.Scroller>
    </Sheet.Content>
  </Sheet.Container>
</Sheet>

Please see the video

https://github.com/Temzasse/react-modal-sheet/assets/16700053/fe50a421-17e6-4436-88f5-9d310ecd9453

mghdmi commented 9 months ago

I have the same issue. when there is an input in the modal scroll is flickering

AlexandrosGounis commented 9 months ago

This is related to scroll-locking on iOS safari (see use-prevent-scroll#L104-L250), #138 proposes a flag so that we can opt-out For the most part, this library is meant for mobile, that's where we need sheets. I think we should do our best to support iOS safari and have more flexibility on mobile in general.

Temzasse commented 9 months ago

Body scroll locking can now be disabled with disableScrollLocking in v2.1.0. Hopefully that helps!

Keyboard related issues are something I need to find a good solution for and if you guys have any other suggestions those are warmly welcome 😊

mleister97 commented 9 months ago

Many thanks, @Temzasse. I've tested it on different iOS devices, and it's working well.

Solution

Update package.json from

"react-modal-sheet": "^2.0.0"

to

"react-modal-sheet": "^2.1.0"
<Sheet
  isOpen={true}
  disableDrag={true}
  detent="full-height"
  snapPoints={[0.75]}
  onClose={() => {}}
  disableScrollLocking={true} // add this one <----------
>
  <Sheet.Container>
    <Sheet.Content>
      <Sheet.Scroller >
        Some text & inputs
      </Sheet.Scroller>
    </Sheet.Content>
  </Sheet.Container>
</Sheet>