I have used Scrollview in my screen and when I log y offset I get negative values?
How can I disable Scrollview bouncing?
I have used Scrollview in my screen and when I log y offset I get negative values?
How can I disable Scrollview bouncing?
This code should worked:
<ScrollView
alwaysBounceHorizontal={false}
alwaysBounceVertical={false}
bounces={false}
/>
set this:
<ScrollView bounces={false}>
...
</ScrollView>
The answers given by others only solve the issue for iOS, but for Android, the issue still persists.
Here is the final solution I found after some digging.
Solution for iOS: (https://reactnative.dev/docs/scrollview#bounces-ios)
<ScrollView
alwaysBounceHorizontal={false}
alwaysBounceVertical={false}
bounces={false}
/>
Solution for Android: (https://reactnative.dev/docs/scrollview#overscrollmode-android)
<ScrollView
overScrollMode="never"
/>
There are props called alwaysBounceVertical
. Set it to false.
<ScrollView
alwaysBounceVertical={false}
/>
Here is doc.
<ScrollView style={styles.content} scrollEventThrottle={16} alwaysBounceVertical={false} onScroll={Animated.event( [{ nativeEvent: { contentOffset: { y: this.scrollYAnimatedValue } } }], { listener: (event) => this._handleScroll(event) } )}>
–
Mulry alwaysBounceVertical={false}
, scrollview still bouncing ? –
Grados onScroll
. It should be onScroll={() => { // your code }}
–
Grados © 2022 - 2024 — McMap. All rights reserved.