Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

Scrolling

mashwinprdxn edited this page Jun 28, 2018 · 4 revisions

Detect scrolling to prevent accidental swipeouts

Set an initial boolean state for scrolling

getInitialState: function() {
  return {
    scrollEnabled: true
  }
}

Create a function to change scroll state

_allowScroll: function(scrollEnabled) {
  this.setState({ scrollEnabled: scrollEnabled })
},

Connect scrollEnabled prop to scroll state

scrollEnabled can be set for ScrollView or ListView and will disable scroll when set to false. Swipeout scroll returns false when swiping horizontally and true when swiping vertically.

<ScrollView scrollEnabled={this.state.scrollEnabled}...>
 <Swipeout scroll={event => this._allowScroll(event)}>...</Swipeout>
<ScrollView/>