Conversation
| return ( | ||
| <ScrollView | ||
| bounces={false} | ||
| bounces={this.props.onRefresh} |
There was a problem hiding this comment.
Enable bounces in order for pull to refresh to work
| bounces={false} | ||
| bounces={this.props.onRefresh} | ||
| refreshControl={this.props.onRefresh && ( | ||
| <RefreshControl onRefresh={this.props.onRefresh} refreshing={this.props.refreshing} enabled={this.state.scrollEnabled} /> |
There was a problem hiding this comment.
Disable RefreshControl when scrollEnabled is false because that means we are processing a drag of an item. The drag can conflict with the pull to refresh gesture if it is left enabled.
| componentDidMount() { | ||
| this.initTag() | ||
| this.autoMeasureHeight() | ||
| this.isHasMeasure = true; |
There was a problem hiding this comment.
Prevent autoMeasureHeight from running again due to componentDidUpdate(). If we don't do this then before the first reorder (which sets isHasMeasure to true) pull to refresh acts very janky because we are pulling to refresh so the refreshing prop updates but then autoMeasureHeight causes the ScrollView to scroll.
| onPanResponderMove: (evt, gestureState) => this.moveTouch(evt, gestureState), | ||
| onPanResponderRelease: (evt, gestureState) => this.endTouch(evt), | ||
|
|
||
| onPanResponderTerminate: (evt) => this.endTouch(evt), |
There was a problem hiding this comment.
Fixes a problem with some gesture handling when the ScrollView captures the gesture
| height: Math.ceil(dataSource.length / rowNum) * itemHeight, | ||
| itemWidth, | ||
| itemHeight, | ||
| scrollEnabled: true, |
There was a problem hiding this comment.
Default this to true so refresh control is enabled before an item is dragged
|
It would be nice if this PR merged 🔥💪 Thanks @avertin 🤚🤚 |
Happy to update the README if these changes look good
Originally written by @annepham25 and @aarondail
Also requested by @eraldoforgoli - issue #107