React-native-reanimated-bottom-sheet: How to deal with nested scroll view

Created on 19 Sep 2019  路  9Comments  路  Source: osdnk/react-native-reanimated-bottom-sheet

Hello guys, I want to nested scroll view inside renderContent function and make its behavior the same with bottom sheet behavior

renderInner = () => {
     return <ScrollView/>  // <= How to make this one pass gesture to parent wrapper when it is scrolled to top
}

Any help with this one ?

Most helpful comment

When you use:
enabledContentGestureInteraction={false}
on BottomSheet you can scroll the ScrollView and use Press Interactions etc.

Happy Coding!

I misunderstood the problem, please ignore this.

All 9 comments

I am having this problem as well.
+1

use nestedScrollEnabled

<ScrollView nestedScrollEnabled>{child}</ScrollView>

Same here. Any updates would be much appreciated!

When you use:
enabledContentGestureInteraction={false}
on BottomSheet you can scroll the ScrollView and use Press Interactions etc.

Happy Coding!

I misunderstood the problem, please ignore this.

I have a same issue here.
I think nestedScrollEnabled and enabledContentGestureInteraction={false} don't help us implementing make <ScrollView> pass gesture to parent wrapper when it is scrolled to top, or maybe I missed something?

For clarity, I want to implement modal dismissing on swipe down if nested ScrollView is scrolled to top already. Like default Modal do since iOS 13.

I tried to disable enabledInnerScrolling if ScrollView.contentOffset.y <= 0, but enabledInnerScrolling is static and can't be changed after constructor()

Any ideas? This issue looks like closest one for my task.

I have same issue :( Any updates would be clear my issue

Use the onScroll prop to watch for the begin/end of a scroll and snap to the according position.

  function handleScroll({nativeEvent: {contentOffset: {y}}}) {
    // you might want to change these values
    const thresholdTop = -60;  
    const thresholdBottom = 0; 

    if (y < thresholdTop) bottomSheet.current.snapTo(0) // if ScrollView has been dragged on top, snap sheet to the bottom
    else if (y > thresholdBottom) bottomSheet.current.snapTo(1) // if ScrollView has been scrolled up, snap sheet to the top
  }

  function renderContent() {
    return (
      <ScrollView onScroll={handleScroll}>
         // your content
      </ScrollView>
    )
  }

if You set the nested ScrollView / FlatList style to have a zIndex : 1 , then the first tap gesture made should be detected by the scrolling view before the bottom sheet. this was my only working work around for nested scroll view in BottomSheet for Android. Still works the same on IOS

Was this page helpful?
0 / 5 - 0 ratings