react native 禁用 ScrollView 的橡皮筋回弹效果

1,841 阅读1分钟

安卓

// overScrollMode 为安卓平台配置
// bounces 为ios平台配置
<ScrollView overScrollMode={"never"} bounces={false}>...</ScrollView>

附上两个配置的API,看配置名也基本知道是影响什么API了

安卓

配置项:overScrollMode
Used to override default value of overScroll mode.

Possible values:

-   `'auto'- Allow a user to over-scroll this view only if the content is large enough to meaningfully scroll.
-   `'always'- Always allow a user to over-scroll this view.
-   `'never'- Never allow a user to over-scroll this view.
-   Default is `'auto'`
IOS
配置项:bounces 弹跳

When true, the scroll view bounces when it reaches the end of the content 
if the content is larger than the scroll view along the axis of the scroll direction