react-native-reanimated-bottom-sheet icon indicating copy to clipboard operation
react-native-reanimated-bottom-sheet copied to clipboard

react-native-community/viewpager inside Bottomsheet in android not scrolling

Open mitsest opened this issue 4 years ago • 3 comments

You can scroll the viewPager only if you use 2 fingers.

Any hints?

We do want to keep the gestures enabled for the bottomsheet, if possible

mitsest avatar Jul 20 '20 10:07 mitsest

@mitsest use FlatlLst or ScrollView from react-native-gesture-handler

ruslan-hontar avatar Aug 03 '20 23:08 ruslan-hontar

In addition to what @ruslan-hontar suggested, If You also 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.

fsobh avatar Aug 31 '20 14:08 fsobh

I discovered a workaround for this. I use a <ViewPager /> (now called <PagerView />) in my bottom sheet and couldn't get it to scroll horizontally on Android.

What I did was set enabledGestureInteraction to false and wrapped my bottom sheet component that gets rendered in the renderContent prop of the <BottomSheet /> in 2 <FlingGestureHandler /> components from react-native-gesture-handler--one to track an upwards fling and one to track a downwards fling. Then I just used the bottomSheetRef.snapTo(index) whenever it registers a fling event to snap to the correct view. Not quite as smooth but still works well!

trentcowden avatar Mar 31 '21 00:03 trentcowden