Sad*_*and 6 react-native react-native-flatlist
我使用react-native FlatList组件来查看项目列表Pagination没有按预期发生,因为文档onEndReached必须在到达页面结束时被触发,目前我尝试更改onEndReachedThreshold的值(尝试0.1,1.0,0.5, 0.01),我也设置刷新标志.注意:我使用的是ReactNative 0.48.4所以这里是我的代码
<Container style={{ marginTop: 22 }}>
<Content
style={{ flex: 1 }}
contentContainerStyle={{ flexGrow: 1 }}
>
<View style={{ flex: 1 }}>
<FlatList
initialNumToRender={10}
refreshing={this.state.refreshing}
onEndReachedThreshold={0.5}
onEndReached={({ distanceFromEnd }) => {
console.log('on end reached ', distanceFromEnd);
}}
data={this.props.messages}
renderItem={this.notificationContent.bind(this)}
keyExtractor={(item) => item._id}
/>
</View>
</Content>
</Container>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了所有可能的解决方案作为回应github问题
这里有帮助吗?
小智 5
我也发生同样的事情,你需要添加 contentContainerStyle={flex:1}
<Content contentContainerStyle={{ flex: 1 }}>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7072 次 |
| 最近记录: |