react-native: TypeError: Cannot read property 'getItem' of undefined

Uncaught TypeError: Cannot read property ‘getItem’ of undefined at FlatList._checkProps (FlatList.js:452) at new FlatList (FlatList.js:396) at constructClassInstance (ReactNativeRenderer-dev.js:7726) at updateClassComponent (ReactNativeRenderer-dev.js:12729) at beginWork (ReactNativeRenderer-dev.js:14756) at Object.invokeGuardedCallbackProd (ReactNativeRenderer-dev.js:93) at invokeGuardedCallback (ReactNativeRenderer-dev.js:318) at beginWork$1 (ReactNativeRenderer-dev.js:19820) at performUnitOfWork (ReactNativeRenderer-dev.js:18563) at workLoopSync (ReactNativeRenderer-dev.js:18499)

React Native version:

Run react-native info in your terminal and copy the results here.

===================== info Fetching system and libraries information… System: OS: macOS 11.2.3 CPU: (4) x64 Intel® Core™ i7-7567U CPU @ 3.50GHz Memory: 1.71 GB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 15.7.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.6.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: Not Found IDEs: Android Studio: 4.1 AI-201.8743.12.41.7042882 Xcode: 12.4/12D4e - /usr/bin/xcodebuild Languages: Java: 15.0.2 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: ^17.0.2 => 17.0.2 react-native: ^0.64.0 => 0.64.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

====================================

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Error is triggered when FlatList is used on any page
  2. VirstualList does not trigger this error

=================================

Expected Results

Describe what you expected to happen. To run the below list of data

children: Array(15) 0: {index: 0, name: “Afghanistan”, code: “AF”, states: Array(34)} 1: {name: “Albania”, code: “AL”, states: Array(12)} 2: {index: 2, name: “Algeria”, code: “DZ”, states: Array(48)} 3: {index: 3, name: “American Samoa”, code: “AS”} 4: {index: 4, name: “Andorra”, code: “AD”, states: Array(7)} 5: {index: 5, name: “Angola”, code: “AO”, states: Array(18)}

===========================

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

<SafeAreaView> {props?.list?.length ? ( <FlatList data={props.list} extraData={itemSelected} renderItem={({ item, index }) => { return renderView(item, index) }} keyExtractor={(item) => item.group} /> ) : null} </SafeAreaView>

========================= Screenshots

Ios

error

Android

error-android

Description

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15

Most upvoted comments

Pretty the same error. Try few libraries which use FlatList (for example react-native-autocomplete-input), then I try use an example from original Rn docs https://reactnative.dev/docs/flatlist Get same error with getItem I use 0.64.0 and get this problem. Downgrading to 63.2 help me and fix this error. Trying new 0.65 version (release candidate) also show this error

RN 0.70.6 the same issue.

RN 0.66.2/0.66.3 the same issue.

RN 0.66 the same issue.