Nil
Nil

Reputation: 79

null is not an object (evaluating 'RNGestureHandlerModule.State)

I'm building an app in react native, everything was working fine, and everytinhg is still working fine on android emulator, but on ios emulator I keep getting this error.

It seems to be linked with stackNavigator but I don't understand why it would suddenly stop working and still working on android.


import {
  createStackNavigator, createAppContainer
} from 'react-navigation';

import TabNavigation from './NavigationScreens/TabNavigation';
import LoginScreen from './Screens/LoginScreen';

const RootStack = createStackNavigator(
  {
    LoginScreen: {
      screen: LoginScreen,
      navigationOptions :{ headerLeft: null}
    },
    TabNavigation: {
      screen: TabNavigation,
      navigationOptions :{ headerLeft: null }
    }
  },
  {
    initialRouteName: 'TabNavigation'
  }
);

const MyApp = createAppContainer(RootStack);

export default MyApp;

I installed and linked rn-gesture-handler-module as I saw it many times on solutions but it doesn't change anything.. any help ?

Upvotes: 2

Views: 3073

Answers (4)

Yumi Yi
Yumi Yi

Reputation: 46

I had the same issue on ios, I tried to init a new react-native project, installed react-navigation and react-native-gesture-handler, linked them, then the error was fixed!

I think init a new project is the fastest way to fix the issue.

Upvotes: 0

martwetzels
martwetzels

Reputation: 437

Not sure if you are still experiencing the issue but often cleaning the current build and building again does the trick for me after linking a module. I had the same issue on Android just now and that fixed it (again). iOS or Android shouldn't matter in this case.

Upvotes: 0

Uj Corb
Uj Corb

Reputation: 2159

If you are using cocoapods, try to run:

cd ios
pod install
cd ..
react-native run-ios

Upvotes: 3

displayname
displayname

Reputation: 1074

instead of setting navigationOptions:{headerLeft: null}, have you tried setting it up as, since it seems like you don't want the header:

const RootStack = createStackNavigator({
 LoginScreen : {screen: LoginScreen,},
 TabNavigation :{screen: TabNavigation,},
},{
 initialRouteName: 'TabNavigation',
 headerMode: 'none'}
);

Upvotes: 0

Related Questions