我在我的本机应用程序中使用“ ModalFilterPicker”。问题是滚动上没有加载更多选项。 从'react-native'导入{组件,视图,文本,TouchableOpacity} 从'react-native-modal-filter-picker'导入ModalFilterPicker 导出默认类App扩展组件{ 构造函数(props,ctx){ 超级(props,ctx); this.state = { 可见:错误, 选择:null, }; } _装载更多() { console.log(“加载更多”) } render(){ const {可见,已选取} = this.state;
const options = [
{
key: 'kenya',
label: 'Kenya',
},
{
key: 'uganda',
label: 'Uganda',
},
{
key: 'libya',
label: 'Libya',
},
{
key: 'morocco',
label: 'Morocco',
},
{
key: 'estonia',
label: 'Estonia',
},
];
return (
<View style={styles.container}>
<TouchableOpacity style={styles.buttonContainer} onPress={this.onShow}>
<Text>Select country</Text>
</TouchableOpacity>
<Text style={appStyles.label}>Selected:</Text>
<Text>{picked}</Text>
<ModalFilterPicker
visible={visible}
onSelect={this.onSelect}
onCancel={this.onCancel}
options={options}
onEndReached={() =>
this._loadMore()}
/>
</View>
);
}
onShow = () => {
this.setState({ visible: true });
}
onSelect = (picked) => {
this.setState({
picked: picked,
visible: false
})
}
onCancel = () => {
this.setState({
visible: false
});
}
}
但是这里的问题是它一次加载所有数据,我需要在这里延迟加载,先加载30条记录,然后再滚动加载其他30条记录。