Skip to content

FlatList doesnot load data after the initialNumToRender count exceeds. #36766

@ReactRaylogic

Description

@ReactRaylogic

Description

If the initial state of list is empty and it fills in componentDidMount the flatlsit will only render first 10 items from the list of 60.
It doenot renders the item after the initialNumToRender count.

React Native Version

0.71.5

Output of npx react-native info

System:
OS: macOS 12.6
CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
Memory: 37.58 MB / 8.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.13.0 - /usr/local/bin/node
Yarn: Not Found
npm: 8.19.3 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.17 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.1 => 0.71.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

class MyRoomsScreen extends Component {
constructor(){
super()
this.state = {
data: []
}
componentDidMount(){
loadData()
}

loadData(){
let roomArray = []
for(let i =0; i<30;i++){
roomArray.push({id: i+1; name: `Room ${i+1}` })
}
this.setState({data: roomArray})
}

renderRoomList =({item, index}) => {
return(<Text>{item.name} </Text>)
}

render(){
return(
<View>
<FlatList data={this.state.data} renderItem={this.renderRoomList}   />
</View>
)}

Snack, code example, screenshot, or link to a repository

...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions