admin管理员组文章数量:1315376
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?
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?
Share Improve this question asked Feb 24, 2018 at 19:32 Simon AnderssonSimon Andersson 7912 gold badges9 silver badges32 bronze badges 3-
Set
decelerationRate
to"fast"
. facebook.github.io/react-native/docs/… – Wainage Commented Feb 25, 2018 at 17:01 - 1 this is IOS only – Simon Andersson Commented Feb 26, 2018 at 18:36
- any luck with this 8 months later? – jpls93 Commented Oct 8, 2018 at 12:44
3 Answers
Reset to default 2Using decelerationRate
prop with value 0
can help.
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>
** I am using RN v0.59 **
Add 2 following properties to ScrollView
:
snapToInterval={1}
disableIntervalMomentum={true}
Why not try this (RN 0.55)
<ScrollView
ref={r => (this.scrollView = r)}
onScrollEndDrag={e => {
return this.scrollView.scrollTo({ y: e.nativeEvent.contentOffset.y });
}}>
...
</ScrollView>
本文标签: javascriptReact Native Scrollview Stop Momentum (expo)Stack Overflow
版权声明:本文标题:javascript - React Native Scrollview Stop Momentum? (expo) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741974523a2408041.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论