javascript - How to stop swipe in ScrollView? - Stack Overflow

look this video of current scrolling behavior. i want, as soon as finger is lifted from screen, to disa

look this video of current scrolling behavior. i want, as soon as finger is lifted from screen, to disable scrolling.

Edit: the video shows a user scrolling through a list. When the finger is lifted from the screen, you see the scrolling continues up or down for a short time.

look this video of current scrolling behavior. i want, as soon as finger is lifted from screen, to disable scrolling.

Edit: the video shows a user scrolling through a list. When the finger is lifted from the screen, you see the scrolling continues up or down for a short time.

Share Improve this question edited Dec 5, 2017 at 0:27 leanne 8,8091 gold badge57 silver badges81 bronze badges asked Dec 4, 2017 at 14:49 Andrey ShostikAndrey Shostik 1942 silver badges13 bronze badges 1
  • Added an explanation of the video. This way, readers don't have to leave this page to understand what you're looking for. Also, if the video is unavailable for some reason, people still can understand your question. – leanne Commented Dec 5, 2017 at 0:27
Add a ment  | 

3 Answers 3

Reset to default 3

I think what you need is:

<ScrollView
  bounces={false}
  />

This way when you scroll finished, the scroll animation will not continue and immediately stopped.

What I believe you want is basically to stop the scroll when momentum beings. For that, you can use the onMomentumScrollBegin callback on your ScrollView and call .scrollToEnd({animated: false}) on it.

Here's how that would look:

<ScrollView
  ref={(ref) => this.scrollView = ref}
  scrollEnabled={this.state.scroll}
  onMomentumScrollBegin={
    () => this.scrollView.scrollToEnd({animated: false})
  }
 >
   ...CONTENT HERE...
 </ScrollView>

i think u mean stop scrolling once user lifts his finger try :

<ScrollView 
  ...

  decelerationRate = {0}
  />

check docs

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744727195a4590250.html

相关推荐

  • javascript - How to stop swipe in ScrollView? - Stack Overflow

    look this video of current scrolling behavior. i want, as soon as finger is lifted from screen, to disa

    17小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信