[v4] | Horizontal scrollView not working on Android
See original GitHub issueBug
I used react-native-swipper as carousel image. It’s a horizontal scrollView The scrolling only works on iOS but not on Android
Environment info
Library | Version |
---|---|
@gorhom/bottom-sheet | ^4.1.4 |
react-native | 0.66.3 |
react-native-reanimated | 2.2.4 |
react-native-gesture-handler | 1.10.3 |
Steps To Reproduce
index.js
<BottomSheetModalProvider>
<App />
</BottomSheetModalProvider>
<BottomSheetModal
backdropComponent={renderBackdrop}
ref={modalRef}
index={0}
snapPoints={snapPoints}
handleComponent={() => <></>}
backgroundComponent={() => <></>}
onAnimate={(fromIndex, toIndex) => {
if (fromIndex === -1 && toIndex === 0) {
Keyboard.dismiss();
}
}}
>
<>
{header}
<View style={styles.container}>
<View style={styles.wrapperSwiper}>
<SwiperComponent
>
{images.map((image) => (
))}
</SwiperComponent>
</View>
</View>
</>
</BottomSheetModal>
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:11
Top Results From Across the Web
android - HorizontalScrollView not working - Stack Overflow
Make HorizontalScrollView's with to "wrap_content" and maintain a single child to the HorizontalScrollView i.e.
Read more >HorizontalScrollView - Android Developers
HorizontalScrollView only supports horizontal scrolling. For vertical scrolling ... Whether or not the auto handwriting initiation is enabled in this View.
Read more >HorizontalScrollView cuts off part of layout if inner container ...
If HorizontalScrollView hosts a layout with items and layout declares a layout_gravity="center_horizontal" then the following behavior is noticed:
Read more >ScrollView And Horizontal ScrollView Tutorial With Example In ...
Tutorial on Scrollview and Horizontal ScrollView teaches how views are make scrollable vertically and horizontally using examples and code in Android ...
Read more >HorizontalScrollView in Kotlin - GeeksforGeeks
In Android ScrollView allows multiple views that are places within the parent view group to be scrolled. Scrolling in the android ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
try adding this to the BottomSheet component, it works well for me.
activeOffsetX={[-999, 999]} activeOffsetY={[-5, 5]}
<BottomSheet name="A" ref={oBottomSheetFilterRef} index={1} snapPoints={aSnapPointsFilter} animatedPosition={oAnimatedPosition} activeOffsetX={[-999, 999]} activeOffsetY={[-5, 5]} >
So BottomSheet will only activate the gesture handler if you move more than 5 points upwards or downwards (in this case travel more than 10 points on the y axis), and it will activate when you move 999 points leftwards or rightwards (x axis). Usually you don’t move that much leftwards or rightwards on your phone, and it will thus not activate the bottom sheet handler. By not activating the bottom sheet handler (when moving leftwards or rightwards) the gesture handler will be passed down to the FlatList component.
This problem doesn’t occur on the emulator. On some physical devices where this problem occur the above code will solve it.
Update: despite scrolling after replacing the regular
ScrollView
withBottomSheetScrollView
, it still didn’t work quite well on Android. Sometimes it scrolled fine, but sometimes the scrollable lost its offset, and snapped to the beginning of the view. Solved by importing theScrollView
fromreact-native-gesture-handler
(similar to @AlexArendsen’s update)