react-native-viewpager icon indicating copy to clipboard operation
react-native-viewpager copied to clipboard

PanResponder vs ViewPager

Open enigmablue opened this issue 6 years ago • 0 comments

Hi,

As soon as we put in a PanResponder, the swipe gesture fails in the ViewPager. Any one knows why?

  const panResponder = PanResponder.create({
      onStartShouldSetPanResponderCapture: (evt, gestureState) => true,
        onPanResponderGrant: ({ nativeEvent: { touches } }, { x0 }) =>{
            if (this.state.horizontalShares.length > 0 && (x0 > (Dimensions.get('window').width / 1.3))){
                this.setState({moveHorizontal: "next"})
            }
            if (this.state.horizontalShares.length > 0 && this.state.horizontalIndex !== 0 &&
                (x0 < (Dimensions.get('window').width / 1.3))) {
                    this.setState({moveHorizontal: "back"})
            }
        }
    });

enigmablue avatar Mar 28 '20 02:03 enigmablue