I just found that there is no permanent Scroll bar for ScrollView. I went through all the documentation and google but I don't think it actually exists.
How do we implement permanent Scroll Bar for <ScrollView>
? How do we keep Scroll Bar visible?
Add a View component whose height is set to 100% . This will display the scroll bar with as much height as the height of its parent container.
Use overflow: auto . Scrollbars will only appear when needed. (Sidenote, you can also specify for only the x, or y scrollbar: overflow-x: auto and overflow-y: auto ).
In Flatlist set scrollsToTop={false} this will retain position when you navigate back from detail screen.
ScrollView
has a prop called persistentScrollbar
.
You can set the boolean to be true
by adding persistentScrollbar={true}
to make scrollbars visible permanently, even when they are not in use.
This only works for Android.
React Native's Official Documentation
It's simple.
<ScrollView showsVerticalScrollIndicator={true} persistentScrollbar={true}></ScrollView>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With