我正在使用nativebase。
我想有一个下拉刷新列表。
我有一个AppContainer,其中包含页眉,页脚和内容:
<Container>
<StatusBar backgroundColor={colors.primary} />
{renderHeader(this.props)}
<Content contentContainerStyle={{ flexGrow: 1 }}>{this.props.children}</Content>
{renderFooter(this.props)}
</Container>
然后我在AppContainer中拥有了平面列表:
<AppContainer>
<TransactionList />
</AppContainer>
[TransactionList是单位列表:
<View style={styles.container}>
<FlatList
data={datas}
extraData={this.state}
renderItem={this.renderList}
keyExtractor={item => item.item}
onRefresh={this.refreshList}
refreshing={this.state.refreshing}
/>
</View>
但是由于AppContent内容是ScrollList,所以不显示请求刷新。
我该如何解决?
[RefreshControl是react-native组件,官方的react-native文档已经使用ScrollView(https://facebook.github.io/react-native/docs/refreshcontrol)显示了它的示例,但它与FlatList的道具完全相同:
return (
<SafeAreaView style={styles.container}>
<ScrollView
contentContainerStyle={styles.scrollView}
refreshControl={
<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
}
>
<Text>Pull down to see RefreshControl indicator</Text>
</ScrollView>
</SafeAreaView>
);
}