Solved: how to hide scrollbar in scrollview react native

There is no way to hide the scrollbar in a scrollview in React Native.


I have a scrollview in react native and I want to hide the scrollbar. How can I do that?


A:

You can use <code>showsHorizontalScrollIndicator</code> and <code>showsVerticalScrollIndicator</code> props of ScrollView to hide horizontal and vertical scrollbars respectively. 
<blockquote>
<p><strong><a href="https://facebook.github.io/react-native/docs/scrollview#props" rel="nofollow noreferrer">https://facebook.github.io/react-native/docs/scrollview#props</a></strong></p>
</blockquote>


<code>&lt;ScrollView
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={false}&gt;
...
&lt;/ScrollView&gt;
</code>

Scrollbar

A scrollbar is a graphical control that allows the user to scroll through a document or web page. Scrollbars are typically displayed in a window’s content area, and can be used to scroll through long documents or pages.

In most browsers, the user can drag the scrollbar left or right to change the amount of content that is visible at one time. In some browsers, the user can also use the keyboard to change the amount of content that is visible.

What is React

React is a JavaScript library for building user interfaces. It lets you create reusable components so that your code is easy to read and maintain. React also makes it easy to create interactive UIs by using stateless components.

React Scrollview

React Scrollview is a library for creating scrollable content in React. It provides a declarative API for creating scrollable components, and supports both vertical and horizontal scrolling.

To use React Scrollview, you first need to install it via npm:

npm install react-scrollview –save

Once installed, you can create a new ScrollView component using the create() function:

var ScrollView = require ( ‘react-scrollview’ ); var MyScrollView = new ScrollView (); MyScrollView . create ({ container : document . getElementById ( ‘my-scroll-container’ ), children : [ { text : ‘Hello, world!’ , }, { text : ‘World!’ , } ] });

Related posts:

1 thought on “Solved: how to hide scrollbar in scrollview react native”

Leave a Comment