如何设置FlatList禁止滚动
来源:7-

lcc_zcq
2018-12-27
如何设置FlatList禁止滚动
写回答
1回答
-
CrazyCodeBoy
2018-12-27
试试这个属性哈:scrollEnabled=false
具体可参考:
https://facebook.github.io/react-native/docs/scrollview#scrollenabled
参考代码:
<FlatList data={store.projectModels} renderItem={data => this.renderItem(data)} keyExtractor={item => "" + item.item.id} scrollEnabled={false} //禁止滚动 refreshControl={ <RefreshControl title={'Loading'} titleColor={theme.themeColor} colors={[theme.themeColor]} refreshing={store.isLoading} onRefresh={() => this.loadData()} tintColor={theme.themeColor} /> } ListFooterComponent={() => this.genIndicator()} onEndReached={() => { console.log('---onEndReached----'); setTimeout(() => { if (this.canLoadMore) {//fix 滚动时两次调用onEndReached https://github.com/facebook/react-native/issues/14015 this.loadData(true); this.canLoadMore = false; } }, 100); }} onEndReachedThreshold={0.5} onMomentumScrollBegin={() => { this.canLoadMore = true; //fix 初始化时页调用onEndReached的问题 console.log('---onMomentumScrollBegin-----') }} />
022019-01-07
相似问题