react-native-actions-sheet
react-native-actions-sheet copied to clipboard
The Back Handler is working,FlatView dont't scroll
hello, The Back Handler is working,but FlatView is not working, dont't scroll 。 #195
after Back Handler, FlatView don’t scroll 。
刚开始 FlatView 是可以滚动,但是当手势返回 关闭actions-sheet 后,FlatView 就滚动不了了。并且往下滑动也无法关闭 actions-sheet。
Are you using useScrollHandlers hook
Are you using
useScrollHandlershook
yeah , and use ref ,is not SheetManager 。
Are you using
useScrollHandlershookyeah , and use ref ,is not SheetManager 。
I will test.
https://user-images.githubusercontent.com/37203543/187102936-07aa1f02-9a21-4ae7-ace4-81a4fdb7a862.mp4
68BCEC0D0AC9C4C57828B418C152FF72.mp4
like this @ammarahm-ed
@13627491210 have you tried on a real device? Is it the same?
And can you share basic code of your ActionSheet component?
@13627491210 have you tried on a real device? Is it the same?
yes,
const scrollHandlers = useScrollHandlers('FlatList-1', actionSheetRef);
<ActionSheet
id="helloworld_sheet"
ref={actionSheetRef}
defaultOverlayOpacity={0}
headerAlwaysVisible
animated
gestureEnabled={true}>
<FlatList
alwaysBounceVertical
ref={scrollViewRef}
id="FlatList-1"
{...scrollHandlers}
style={{height: 350, width: '100%'}}
showsVerticalScrollIndicator={false}
nestedScrollEnabled={true}
showsVerticalScrollIndicator={false}
data={songs}
renderItem={item => {
return SongItem({data: item.item, index: item.index});
}}
keyExtractor={item => item.id}
/>
</ActionSheet>
I was able to reproduce this. There's no easy way to fix the issue. We might need to use react-native-gesture-handler to fix this properly.
I'm also experiencing this, not sure what broke it because it was working before.
I was able to reproduce this. There's no easy way to fix the issue. We might need to use
react-native-gesture-handlerto fix this properly.
but 0.7 is OK 。
I'm also experiencing this, not sure what break it because it was working before.
yeah, but V0.7 is OK , have you tried?
That's right, v0.7 works well. If I recall right v0.8 is a complete rewrite of the library and in my opinion, it's smoother than v0.7, that's why I prefer reporting/fixing the bugs and not downgrading haha.
That's right, v0.7 works well. If I recall right v0.8 is a complete rewrite of the library and in my opinion, it's smoother than v0.7, that's why I prefer reporting/fixing the bugs and not downgrading haha.
yeah, v0.8 is great
That's right, v0.7 works well. If I recall right v0.8 is a complete rewrite of the library and in my opinion, it's smoother than v0.7, that's why I prefer reporting/fixing the bugs and not downgrading haha.
V0.7 uses a ScrollView that's why and the new impl uses Animated.View + PanResponder. So we will have to use react-native-gesture-handler lib to get scrollviews/flatlists working properly without issues.
PanResponder has some limitations in what it can do especially with multiple gestures such as scrolling + panning. I will find a solution to this soon.
Sweet! I tried to take a look at fixing the issue but I don't understand very well all the moving pieces inside the PanResponder so I think I'll leave that to you haha. Thank you in advance.
Sweet! I tried to take a look at fixing the issue but I don't understand very well all the moving pieces inside the
PanResponderso I think I'll leave that for you haha. Thank you in advance.
if you fixed it ,please tell me, thanks.
@ammarahm-ed I'm trying to fix the scrolling issue and if I remove the scrollEnabled property and the setNativeProps calls that disable scrollEnabled from the useScrollHandlers hook, everything works as expected, however, I'm sure that that logic is there for some reason so probably I'm missing something. Could the bug be related to that or is that needed for another use case?
These are the changes that fixed it for me, I'm not sure what implications it has but I'll be using it as a workaround until we find a proper fix.
https://github.com/focux/react-native-actions-sheet/commit/6a781a0e8c6d71b5a63d30ff34e24ceda6402c14
@focux does it make scrolling+ gestures both work inside the ScrollView area?
@ammarahm-ed Yes, I think it does. Not sure if there's another gesture that should work inside the scroll view, besides swiping the sheet down when the scroll view reaches the top.
I will test your implementation.
Hey @focux Did you fix on android or iOS or is it working fine now on both?
So, it's working perfectly on iOS, and on Android, the list works but sometimes, when reaching the top of the list, the swipe doesn't close the action sheet.
I tested on iOS and yes, it seems to work without calling setNativeProps. On android still have to give it a try.
Sweet! Also, removing setNativeProps adds support for using more list components, like FlashList which doesn't support setNativeProps. Also, RN recommends migrating off that, to another method because that won't work on Fabric [1].
- https://reactnative.dev/docs/new-architecture-library-intro#migrating-off-setnativeprops
@focux Hmm will have to see the issue on android though. If we can workout a solution that's dependency free for lists/scrolling views, that would be great I think. 😄 I have really tried very hard to not depend on anything except what RN offers.