[react-native] onPanResponderRelease on FlatList or ListView not firing in android

I have a FlatList component and I want to implement the PanResponder API, below is a part of my code:

componentWillMount() {
    this._panResponder = PanResponder.create({
      onStartShouldSetPanResponder: ()=>true,
      onMoveShouldSetPanResponder: ()=>true,
      onPanResponderGrant: (e, gestureState)=>this.panResponderStart(e, gestureState),
      onPanResponderMove: (e, gestureState)=>this.panResponderMove(e, gestureState),
      onPanResponderRelease: (e, gestureState)=>this.panResponderEnd(e, gestureState),
      onPanResponderTerminate: (e, gestureState)=>this.panResponderEnd(e, gestureState),
    });
}
panResponderEnd(e, gestureState) {
    //this._previousTop += gestureState.dy;
    this.setState({scrollTop:0});
    console.log('release');
}
...
<FlatList
    {...this._panResponder.panHandlers}
    ...

      

onPanResponderRelease

won't start on components FlatList

or ListView

or VirtualizedList

, OS is android, is it an RN error? how to fix this problem, any help is appreciated.

+3


source to share





All Articles