已解決:如何在 scrollview react native 中隱藏滾動條

沒有辦法在 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>

滾動條

滾動條是一種圖形控件,允許用戶滾動瀏覽文檔或網頁。 滾動條通常顯示在窗口的內容區域中,可用於滾動瀏覽長文檔或頁面。

在大多數瀏覽器中,用戶可以向左或向右拖動滾動條來更改一次可見的內容量。 在某些瀏覽器中,用戶還可以使用鍵盤來更改可見內容的數量。

什麼是 React

React 是一個用於構建用戶界面的 JavaScript 庫。 它允許您創建可重用的組件,以便您的代碼易於閱讀和維護。 React 還可以通過使用無狀態組件輕鬆創建交互式 UI。

反應滾動視圖

React Scrollview 是一個用於在 React 中創建可滾動內容的庫。 它提供了一個用於創建可滾動組件的聲明式 API,並支持垂直和水平滾動。

要使用 React Scrollview,首先需要通過 npm 安裝它:

npm 安裝 react-scrollview –保存

安裝後,您可以使用 create() 函數創建一個新的 ScrollView 組件:

var ScrollView = require ( 'react-scrollview' ); var MyScrollView = new ScrollView(); 我的滾動視圖。 創建({ container : document .getElementById ( 'my-scroll-container' ), children : [ { text : 'Hello, world!' , }, { text : 'World!' , } ] });

相關文章:

1 個關於“已解決:如何在滾動視圖中隱藏滾動條反應本機”的思考

發表評論