FlatList renders only 10 items when in BottomNavigation
See original GitHub issueCurrent behaviour
When one of the items in renderScene is a FlatList, only the first 10 (or initialNumToRender) items are rendered.
Expected behaviour
The same number of items rendered by the FlatList as if the FlatList is rendered outside of BottomNavigation.
Code sample
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
FlatList
} from 'react-native';
import { BottomNavigation } from 'react-native-paper';
export default class RouteSelectorTabs extends Component {
constructor(props) {
super(props);
this.state = {
index: 0,
routes: [
{ key: 'flatlist', title: 'FlatList', icon: 'list' },
],
itemsList: [
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
"Item",
]
}
}
handleIndexChange(index) {
this.setState({ index });
}
renderScene({ route, jumpTo }) {
return <FlatList
data={this.state.itemsList}
//initialNumToRender={20}
renderItem={({ item, index }) => {
return <Text key={item.code}>{"item " + index}</Text>;
}}
keyExtractor={(item, index) => "key" + index}
/>
}
render() {
return (
<BottomNavigation
style={{}}
shifting={false}
navigationState={this.state}
onIndexChange={this.handleIndexChange.bind(this)}
renderScene={this.renderScene.bind(this)}
/>
);
}
}
Your Environment
software | version |
---|---|
ios | 11.2 |
react-native | 0.54.0 |
react-native-paper | 1.1.0 |
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
React Native FlatList only renders 10 items - Stack Overflow
I did this but now it's only displaying 50. Still won't load more. Ideally I'd like to initially render 10 then load the...
Read more >FlatList breaking above 10 items : r/reactnative - Reddit
Having an issue with my FlatLists in an app I'm working on, they render perfectly with <10 items, but more than that and...
Read more >Supporting safe areas | React Navigation
While React Native exports a SafeAreaView component, it has some inherent issues, i.e. if a screen containing safe area is animating, it causes...
Read more >React List component - Material UI - MUI
Lists are a continuous group of text or images. They are composed of items containing primary and supplemental actions, which are represented by...
Read more >react native flatlist from bottom to top Code Example
react native flatlist margin bottom ... native component at bottom center · flatlist only rendering 10 items · react native button top right....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
solved for me but I don’t know why this problem is happening adding in her attributes. initialNumToRender={data.length}
Try adding
style={{ flex: 1 }}
in yourFlatList