17 thoughts on “null is not an object ( evaluating ‘RNGestureHandlerModule.default.Direction’)

  1. In react-native@0.59.10 it doesn’t work. I still get the same error, even after jetify “null is not an object ( evaluating ‘RNGestureHandlerModule.default.Direction’)”

    Remove this modification: // export { default as Directions } from ‘./Directions’;

    And if you specified something in your “react-native.config.js”, remove it.

    add these lines in your MainActivity.java:
    import com.facebook.react.ReactActivityDelegate;
    import com.facebook.react.ReactRootView;
    import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;

    And add this inside the MainActivity class, just after protected String getMainComponentName() function
    @Override
    protected ReactActivityDelegate createReactActivityDelegate() {
    return new ReactActivityDelegate(this, getMainComponentName()) {
    @Override
    protected ReactRootView createRootView() {
    return new RNGestureHandlerEnabledRootView(MainActivity.this);
    }
    };
    }

    And after that do:
    cd android
    gradlew clean
    cd ..

    Then do the usual: react-native run-android, and give me the output.
    Good luck.

  2. please check your MainApplication.java
    with react-native 0.60 looks like:

    @Override
    protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          return packages;
    }
    

    if you do not use Autolink function this package will not added try to add

    ... 
    List<ReactPackage> packages = new PackageList(this).getPackages();
    packages.add(new RNGestureHandlerPackage() );
    return packages
    

    and don’t forget the import
    import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;

    Please give feedback if it works

  3. Finally, I quit React Native. Either you can waste your time fixing bugs or you can make your project, it’s on your luck.

  4. For iOS I had to manually add this to the Podfile pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec' and then run pod install for it to work

  5. This worked for me, although not entirely sure it’ll fix everybody’s problem. In these docs https://reactnavigation.org/docs/en/getting-started.html it’s specified:

    To finalize installation of react-native-screens for Android, add the following two lines to dependencies section in android/app/build.gradle:

    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02
    
  6. This worked for me
    npm install –save react-native-gesture-handler
    react-native link
    Again
    cd ios
    pod install

  7. As it turned out all I needed was a gradle clean (./gradlew clean) and then copying the “\android\app\build\outputs\apk\debug\app-debug.apk” manually into the device and installing (also manually) and all errors vanished.

  8. I am using “react-native”: “0.61.5”
    I am working on ubuntu 18.04
    I fixed the issue on my android emulator by following the steps mentioned below

    Make sure you follow steps for the version you are using (React Native 0.61.5 and lower in my case)

    1. Delete/Remove your node_modules directory
      rm -rf node_modules

    2. Install your dependencies again
      If you are using Yarn $ yarn or npm install if you are using npm

    3. Clean your Gradle
      I followed below steps for that:

    cd android
    ./gradlew clean
    cd ..
    react-native run-android

    Good Luck, These steps worked for me

  9. Hi, i’m still facing this issue, the message is slightly different (instead of null is undefined)

    TypeError: undefined is not an object (evaluating '_RNGestureHandlerModule.default.Direction')
    

Comments are closed.

null is not an object ( evaluating ‘RNGestureHandlerModule.default.Direction’)

I’m having this issue in mac os / ios with react-nagivation and react-native-gesture-handler latest release. kindly help!

image

My package.json config:

{
  "name": "appfinance",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/masked-view": "^0.1.7",
    "@react-navigation/native": "^5.1.4",
    "@react-navigation/stack": "^5.2.9",
    "react": "16.8.3",
    "react-native": "0.59.9",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-reanimated": "^1.7.1",
    "react-native-safe-area-context": "^0.7.3",
    "react-native-screens": "^2.4.0",
    "react-navigation": "^4.3.6"
  },
  "devDependencies": {
    "@babel/core": "^7.9.0",
    "@babel/runtime": "^7.9.2",
    "babel-jest": "^25.2.3",
    "jest": "^25.2.3",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

Author: Fantashit

2 thoughts on “null is not an object ( evaluating ‘RNGestureHandlerModule.default.Direction’)

Comments are closed.