react-native-gesture-handler icon indicating copy to clipboard operation
react-native-gesture-handler copied to clipboard

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

Open mohammad-yousuf opened this issue 7 years ago • 105 comments

Screenshot_1562558557

I'm having this issue in Android with react-nagivation and react-native-gesture-handler latest release. kindly help

mohammad-yousuf avatar Jul 08 '19 04:07 mohammad-yousuf

please tell solution for android windows.

On Mon, 8 Jul 2019, 3:54 p.m. Yasir KAVRAŞ, [email protected] wrote:

Hello, 1 - yarn add react-navigation 2 - yarn add react-native-gesture-handler 3 - cd ios/ 4 - pod install 5 - cd .. 6 - react-native run-ios and react-native run-android

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kmagiera/react-native-gesture-handler/issues/676?email_source=notifications&email_token=ALAPVJA3WX5YRBG4HU7IEQDP6MME5A5CNFSM4H6XUVL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZMXEYA#issuecomment-509178464, or mute the thread https://github.com/notifications/unsubscribe-auth/ALAPVJHCAPBRJGN37JN7MKDP6MME5ANCNFSM4H6XUVLQ .

mohammad-yousuf avatar Jul 09 '19 00:07 mohammad-yousuf

I have the same questions.

SeaMoonTime avatar Jul 09 '19 08:07 SeaMoonTime

In 0.60, this is an awful bug. Please solve it as soon as possible.

SeaMoonTime avatar Jul 09 '19 08:07 SeaMoonTime

pod install on ios folder works for me

cd ios
pod install

har2008preet avatar Jul 09 '19 13:07 har2008preet

This worked. Thanks, @har2008preet! 🚀

pod install on ios folder works for me

cd ios
pod install

m2mathew avatar Jul 09 '19 13:07 m2mathew

How resolve it on Android and Window system.

dangtienngoc avatar Jul 10 '19 00:07 dangtienngoc

it works well in iOS, but still fail to run in Android. Who can tell me how to solve the bug in Android?

SeaMoonTime avatar Jul 10 '19 00:07 SeaMoonTime

I run my app on Android successfully with react-native-gesture-handler

  1. I disable autoliking
  2. Using jetify to fix Android X in this time.

dangtienngoc avatar Jul 10 '19 01:07 dangtienngoc

@dangtienngoc , can you help how to use jetify to fix android X?

MrHazimAli avatar Jul 10 '19 03:07 MrHazimAli

@dangtienngoc , can you help how to use jetify to fix android X?

You can check it here: https://github.com/mikehardy/jetifier

dangtienngoc avatar Jul 10 '19 04:07 dangtienngoc

@MrHazimAli I do a video my step resolve issue here:

  • For Android: https://youtu.be/NcQhDlC7hT8
  • For IOS: -- cd ios -- pod install

dangtienngoc avatar Jul 10 '19 05:07 dangtienngoc

thanks @dangtienngoc , working!

MrHazimAli avatar Jul 10 '19 07:07 MrHazimAli

thanks @dangtienngoc , it works!!!!

SeaMoonTime avatar Jul 10 '19 08:07 SeaMoonTime

many thanks for your video. @dangtienngoc , I use jetifier It was been build successful. A anoter error in emulator : TypeError: null is not an object (evaluating '_RNGestureHandlerModule.default.createGestureHandler') This error is located at in PanGestureHandler (at StackViewLayout.tsx:372) Any solutions?

0xinhua avatar Jul 10 '19 09:07 0xinhua

In [email protected] it doesn't work. I still get the same error, even after jetify "null is not an object ( evaluating 'RNGestureHandlerModule.default.Direction')"

meraklis56 avatar Jul 10 '19 09:07 meraklis56

@meraklis56 try to commenting this line:

// export { default as Directions } from './Directions';

in the your project -> node_modules -> react-native-gesture-handler -> GestureHandler.js

Good luck.

0xinhua avatar Jul 10 '19 12:07 0xinhua

Now the error is:

07-10 16:20:38.993 16011 16348 E ReactNativeJS: null is not an object (evaluating '_RNGestureHandlerModule.default.handleSetJSResponder') 07-10 16:20:39.067 16011 16348 E ReactNativeJS: null is not an object (evaluating '_RNGestureHandlerModule.default.handleClearJSResponder')

meraklis56 avatar Jul 10 '19 14:07 meraklis56

In [email protected] it doesn't work. I still get the same error, even after jetify "null is not an object ( evaluating 'RNGestureHandlerModule.default.Direction')"

[email protected] not support android X yet, check your react native cli

^2.0.0 => ^0.60.0 ^1.0.0 => ^0.59.0

Because react native cli ^2.0.0 support auto linking module

dangtienngoc avatar Jul 10 '19 14:07 dangtienngoc

In [email protected] 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.

GeronimoKTT avatar Jul 10 '19 16:07 GeronimoKTT

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

petkir avatar Jul 10 '19 22:07 petkir