Skip to content

TypeError: Cannot read property 'getItem' of undefined #31523

Description

@iababio

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(R) Core(TM) 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:

{props?.list?.length ? ( { return renderView(item, index) }} keyExtractor={(item) => item.group} /> ) : null}

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

Ios

error

Android

error-android

Description

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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