16

I am creating a login system with react-native, after downloading the "react-native-gesture-handler" dependencies: "^ 1.1.0" and "react-navigation": "^ 3.5.1" began to appear the following message error:

null is not an object (evaluating 'rngesturehandlermodule.direction')

I tried to delete the project and reface it, delete and reinstall the node_modules folder and reinstall the dependencies, but nothing worked.

Lab Lab
  • 781
  • 10
  • 34
Bruno Netto
  • 161
  • 1
  • 1
  • 5

15 Answers15

9

I had the same issue. I then installed react-navigation & react-native-gesture-handler step by step as follows:

Steps :

  1. Remove node_modules and package-lock.json

  2. npm install

  3. npm install --save react-navigation

  4. npm install --save react-native-gesture-handler

  5. react-native link

You can find the original answer here

Community
  • 1
  • 1
Pranav Karnik
  • 3,318
  • 3
  • 35
  • 47
9

cd into the ios subdirectory of your project and run pod install.

Andrew Koster
  • 1,550
  • 1
  • 21
  • 31
8
  1. Stop the metro bundler with Ctrl+C from terminal.
  2. Run again metro bundler: npx react-native start
  3. Run again the build command npx react-native run-android

Building process maybe take a few minutes.

Muhammed Ozdogan
  • 5,341
  • 8
  • 32
  • 53
2

I was facing this on Android.

All I did is:

  1. cd android
  2. gradlew clean
  3. closed metro bundler
  4. react-native run-android

solved my issue

Paolo
  • 20,112
  • 21
  • 72
  • 113
Sanan Ali
  • 2,349
  • 1
  • 24
  • 34
1

I had this issue, and just restarted the Metro Bundler and iOS emulator. It seemed to work when I restarted them.

Ben Butterworth
  • 22,056
  • 10
  • 114
  • 167
1

For android,

1--> cd android/

2--> ./gradlew clean

3--> cd ../

4--> Run your project now

I don't know is this an exact answer? But it works for me.

Md. Robi Ullah
  • 1,703
  • 3
  • 20
  • 32
1

Please first run this command in terminal :

npm uninstall react-native-gesture-handler --save 

Second :

npm install react-native-gesture-handler --save

Third :

react-native link react-native-gesture-handler

Forth :

npm start

Finally, this is work.

Mostafa Norzade
  • 1,578
  • 5
  • 24
  • 40
  • after link liked you said, i got another error: requireNativeComponent:"RNCSafeAreaView" was not found in the UIManager – Alone Nascimento Feb 12 '20 at 11:35
  • 1
    Now you do this works => 1:npm nuinstall react-native-safe-area-context --save , 2: npm install react-native-safe-area-context --save , 3: react-native link react-native-safe-area-context , 4: npm start. :)) – Seyed Mostafa Hasani Feb 12 '20 at 12:09
1

I had got the same error on ios from react-native v0.59.9. The following solution works for me.

  1. npm i react-native-gesture-handler
  2. react-native link react-native-gesture-handler
  3. cd ios && pod install && cd ..
  4. react-native run-ios

tip: react-native support autolinking from v0.60.0

Codyi96
  • 11
  • 1
1

I had this problem, I solved it using npm instead of yarn.

1

You need to re-run your application every time you install a new dependency via npm. close app then run npx react-native run-android

1

All I did was :

  1. restart metro server: ctrl+c then yarn start
  2. react-native run-android // basically reinstalling the project after installing react-navigation
0

I have same error but it solve by create file separate file for Navigation File with name "MainNavigator.js"

import { createStackNavigator, createAppContainer } from 'react-navigation'; 
import HomeScreen from '../screen/Home';
import DetailsScreen from '../screen/Details';

    const RootStack = createStackNavigator({
        Home: HomeScreen,
        Details: DetailsScreen,
    }, {
        initialRouteName: 'Home',
    }
    );


const AppContainer = createAppContainer(RootStack);

export default AppContainer;

And Use it in App.js file with following code

import React from 'react';
import RootNavigator from './js/navigation/MainNavigator';
class App extends React.Component {
    render() {
        return <RootNavigator />
    }
}
export default App;
Ahmed Awan
  • 347
  • 3
  • 9
0

if you are using android try this solution : go to : /android/settings.gradle there was string: project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-gesture-handler\android')

tro to change it with : project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-gesture-handler\android') source : #494 (comment)

0

npx pod-install should do the trick for you.

codeoholic
  • 324
  • 1
  • 2
0

If you are on react-native version 0.59.10 try these steps for ios:

  1. Change in package.json "react-native-gesture-handler": "1.1.1"
  2. npx react-native link --platforms ios
  3. Open Xcode and on top where it shows the library > iphone or whatever device your building for, change library to point to RNGestureHandler and run that separately and ensure that builds fine. Then switch back to your project and run/build that.
  4. May not be related but I also had to manually build RN screens.
Christopher Adams
  • 1,240
  • 10
  • 14