【发布时间】:2020-10-24 07:56:06
【问题描述】:
当我加载我的组件时,onEndReached 将在我滚动我的<SectionList /> 之前触发一次,但是当我滚动到底部时,onEndReached 将不再被触发。
这是我的代码:
render (
return (
<View style={{ flex: 1 }}>
<SectionList
style={{ backgroundColor: 'pink' }}
refreshControl={
<RefreshControl
refreshing={false}
onRefresh={() => console.log('refreshControl')}
tintColor='gray'
/>
}
renderSectionHeader={this.sectionHeader}
renderItem={this.renderSectionView}
sections={reservations}
onEndReachedThreshold={0.05}
onEndReached={(data) => {
console.log('data', data); // { distanceFromEnd: -457 }
console.log('onEndReached');
}}
keyExtractor={(item, index) => index}
ItemSeparatorComponent={() => <View style={{ backgroundColor: 'gray', height: StyleSheet.hairlineWidth }} />}
/>
</View>
);
);
在我的<SectionList /> refreshControl 很好,但onEndReached 不起作用,有人知道发生了什么吗?谢谢。
【问题讨论】:
标签: react-native react-native-flatlist react-native-sectionlist