11

I have used Scrollview in my screen and when I log y offset I get negative values?

How can I disable Scrollview bouncing?

Umid Boltabaev
  • 442
  • 2
  • 6
  • 17

4 Answers4

20

This code should worked:

<ScrollView
    alwaysBounceHorizontal={false}
    alwaysBounceVertical={false}
    bounces={false}
/>
ggDeGreat
  • 1,098
  • 1
  • 17
  • 33
  • Accordingly oficial react native documentation this properties use for just IOS, but how about Android? Any ideas how to disable bounce there? – jocoders Apr 26 '23 at 08:01
  • @jocoders, check if this helps - https://stackoverflow.com/a/76123813/5804328 – Piyush Govil Apr 27 '23 at 19:02
10

set this:

<ScrollView bounces={false}>
  ...
</ScrollView>
Audrey
  • 401
  • 2
  • 7
  • 15
1

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"
/>
Piyush Govil
  • 358
  • 3
  • 13
0

There are props called alwaysBounceVertical. Set it to false.

<ScrollView
    alwaysBounceVertical={false}
/>

Here is doc.

Kishan Bharda
  • 5,446
  • 3
  • 30
  • 57