React Native Scrollview 停止动量?(博览会)
问题描述:
我正在使用 ScrollView,当我滚动并让去,它会因为动量而不断滚动.我希望它只在手指触摸屏幕时滚动,我不想要动力.这可能吗,如果可能,怎么办?
I am using a ScrollView, and when I scroll and let go, it keeps scrolling because of momentum. I want it to only scroll when the finger is touching the screen, I do not want the momentum. Is this possible, if so, how?
答
使用值为 0
的 decelerationRate
属性会有所帮助.
Using decelerationRate
prop with value 0
can help.
基于文档,其值接受字符串正常|fast
和浮点数从 0
到 1
从最慢到最快的顺序.
Based on the document, its value accept string normal | fast
and floating number from 0
to 1
orderly from slowest to fastest.
<ScrollView decelerationRate={0}>
</ScrollView>
** 我使用的是 RN v0.59 **
** I am using RN v0.59 **