2017-05-08 18 views
2

如何知道FlatList中的滚动状态? 如startScroll,滚动,endScroll如何知道FlatList中的滚动状态?

<FlatList 
    onScroll={(e) => { }} 
/> 

有onScroll mothed,但它只能运行在滚动。 我想听滚动开始和结束,我该怎么办?

我也尝试过使用TouchableWithoutFeedback:

<TouchableWithoutFeedback 
    onPressIn={() => console.log('in')} 
    onPressOut={() => console.log('out')}> 
    <View><FlatList/></View> 
</TouchableWithoutFeedback> 

但触摸事件将TouchableWithoutFeedback被截获, FlatList不能滚动。

回答

5
<FlatList 
    onScrollEndDrag={() => console.log("end")} 
    onScrollBeginDrag={() => console.log("start")}/> 

这解决它

+0

感谢,这些道具都缺少文档。 –

+0

谢谢,这是非常奇怪,这是没有记录。我想知道它是否被弃用。 –

+0

这不是从文档中丢失。请看看ScrollView的继承道具:https://facebook.github.io/react-native/docs/scrollview.html#props – moritzw

相关问题