garganurag893 / react-native-phone-number-input

React Native component for phone number.
MIT License
373 stars 216 forks source link

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

Closed brokenpieworld closed 1 year ago

brokenpieworld commented 1 year ago

Using React Native 0.71.10 and on iOS.

On clicking on country getting below error:

TypeError: Cannot read property 'getItem' of undefined

This error is located at: in FlatList (created by CountryList) in RCTView (created by View) in View (created by CountryList) in CountryList (created by CountryPicker) in RCTSafeAreaView (created by CountryModal) in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer (created by Modal) in RCTView (created by View) in View (created by Modal) in VirtualizedListContextResetter (created by Modal) in RCTModalHostView (created by Modal) in Modal (created by CountryModal) in CountryModal (created by CountryPicker) in CountryPicker (created by Main) in ThemeProvider (created by Main) in Main (created by PhoneInput) in RCTView (created by View) in View (created by AnimatedComponent) in AnimatedComponent in AnimatedComponentWrapper (created by TouchableOpacity) in TouchableOpacity (created by TouchableOpacity) in TouchableOpacity (created by PhoneInput) in RCTView (created by View) in View (created by PhoneInput) in CountryModalProvider (created by PhoneInput) in PhoneInput (created by Login) in RCTView (created by View) in View (created by Login) in RCTView (created by View) in View (created by Login) in Login (created by SceneView) in StaticContainer in EnsureSingleNavigator (created by SceneView) in SceneView (created by SceneView) in RCTView (created by View) in View (created by DebugContainer) in DebugContainer (created by MaybeNestedStack) in MaybeNestedStack (created by SceneView) in RCTView (created by View) in View (created by SceneView) in RNSScreen (created by AnimatedComponent) in AnimatedComponent in AnimatedComponentWrapper (created by InnerScreen) in Suspender (created by Freeze) in Suspense (created by Freeze) in Freeze (created by DelayedFreeze) in DelayedFreeze (created by InnerScreen) in InnerScreen (created by Screen) in Screen (created by SceneView) in SceneView (created by NativeStackViewInner) in Suspender (created by Freeze) in Suspense (created by Freeze) in Freeze (created by DelayedFreeze) in DelayedFreeze (created by ScreenStack) in RNSScreenStack (created by ScreenStack) in ScreenStack (created by NativeStackViewInner) in NativeStackViewInner (created by NativeStackView) in RNCSafeAreaProvider (created by SafeAreaProvider) in SafeAreaProvider (created by SafeAreaInsetsContext) in SafeAreaProviderCompat (created by NativeStackView) in NativeStackView (created by NativeStackNavigator) in PreventRemoveProvider (created by NavigationContent) in NavigationContent in Unknown (created by NativeStackNavigator) in NativeStackNavigator (created by HomeNavigation) in EnsureSingleNavigator in BaseNavigationContainer in ThemeProvider in NavigationContainerInner (created by HomeNavigation) in HomeNavigation (created by App) in App (created by Root) in RCTSafeAreaView (created by Root) in RCTView (created by View) in View (created by KeyboardAvoidingView) in KeyboardAvoidingView (created by Root) in TouchableWithoutFeedback (created by Root) in RCTView (created by View) in View (created by GestureHandlerRootView) in GestureHandlerRootView (created by Root) in MobXProvider (created by Root) in Root in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer in SnogRider(RootComponent), js engine: hermes

dackom commented 1 year ago

Anyone solved this? I have same issue.

nicolasSagon commented 7 months ago

I encounter the same issue. And the problem is linked with the Flatlist lib itself. A very simple patch for React-native 0.73.0 I have check in 0.73.6 and it's still broken :

diff --git a/node_modules/react-native/Libraries/Lists/FlatList.js b/node_modules/react-native/Libraries/Lists/FlatList.js
index 1b2ee17..eb17551 100644
--- a/node_modules/react-native/Libraries/Lists/FlatList.js
+++ b/node_modules/react-native/Libraries/Lists/FlatList.js
@@ -420,6 +420,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {

   constructor(props: Props<ItemT>) {
     super(props);
+    this.props = props;
     this._checkProps(this.props);
     if (this.props.viewabilityConfigCallbackPairs) {
       this._virtualizedListPairs =