Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 28468

[react-native]onPanResponderRelease on FlatList or ListView doesn't trigger in android

$
0
0

I have a FlatList component, and I want realize PanResponder API on it, below is 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 doesn't trigger on FlatList or ListView or VirtualizedList component, OS is android, is it a RN's bug? how to resolve this problem, any help is appreciated.


Viewing all articles
Browse latest Browse all 28468

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>