I'm trying to display a FlatList with a dataset of 86 items and it's only displaying 10 and will not load more.
I tried messing with the container size through styles but no avail.
return (
<View>
<Text>{this.state.cards.length}</Text>
<FlatList
data={this.state.cards}
renderItem={(theInfo) => <CardImage key={theInfo.key} info={theInfo}/>}
keyExtractor={(item, index) => item.toString()}
/>
</View>
);
I expect this to display 86 items (this.state.cards.length displays 86), the application only displays 10 and will not load more.
Edit: rn version 0.57.8
You should set following property
initialNumToRender={50}
As the default is 10
Source: https://facebook.github.io/react-native/docs/flatlist#initialnumtorender
Change View to ScrollView
Updated Code:
return (
<ScrollView>
<Text>{this.state.cards.length}</Text>
<FlatList
data={this.state.cards}
renderItem={(theInfo) => <CardImage key={theInfo.key} info={theInfo}/>}
keyExtractor={(item, index) => item.toString()}
/>
</ScrollView>
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With