Closed blackpencil8994 closed 3 years ago
I am getting the same error.
Have you tried this? This solved my problem
Thank you for the quick response that solved the problem for me.
Thanks @ajboxjr for your help,
I did follow your step and successfully run by XCode.
But it's still not working with react-native run-ios
Finally I did the same with new project and it worked for me.
So we need to manual linking react-native-gesture-handler
with this new version
Thank you all.
Hi, I have the same issue in Android app. Could you please help me to fix it?
EDIT: This issue appears only if I do not update MainActivity.java. After updating this file react-native run-android is failed:
I have tried to make an installation on a new project and this error still appears.
@amrita6 you can link automatically in Android. But you need to manual link in iOS project. After install package, try this:
react-native link react-native-gesture-handler
Hope this helps.
@blackpencil8994 thanks but I needed Android only. I have found the reason already: in /android/settings.gradle there was string: project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-gesture-handler\android')
I've changed this to: project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '..\\node_modules\\react-native-gesture-handler\\android')
and this helped me. Strange that it has happened so.
@blackpencil8994 thanks but I needed Android only. I have found the reason already: in /android/settings.gradle there was string: project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-gesture-handler\android')
I've changed this to: project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-gesture-handler\android')
and this helped me. Strange that it has happened so.
Two strings are the same...
@markhker strange but there was two backslashes but it showed as one. I've changed it already.
I'm still getting this after trying everything above, same versions as mentioned previously.
I'm having this same issue. Why would I need to manually link in iOS. I actually went into my xCode project and its linked fine.
I looked in GestureHandler.js
and its says import Directions from ./Directions;
, but no such object Directions
exists in Directions.js.
It sets NativeModules from react-native to RNGestureHandlerModule
with method .Direction
(which doesn't exist). Produces error null is not and object (evaluating 'RNGestureModule.Direction')
same issue here :(
ok, in my case solved by adding:
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
....
protected List<ReactPackage> getPackages() {
// Add additional packages you require here
// No need to add RnnPackage and MainReactPackage
return Arrays.<ReactPackage>asList(
....
new RNGestureHandlerPackage()
);
}
to android/app/src/main/java/com/projectname/MainApplication.java
I ended up just giving up and building my own navigation component, haha.
I may have the answer to this!!!!
I was in some of my ES6 constants file... and I added a TouchableOpacity by accident, instead of the usual TouchableHighlight in some JSX.
My editor (Visual Studio Code) seemed to have added:
import { TouchableOpacity } from 'react-native-gesture-handler';
at the top of my file!!! WIthout my asking for it!
Go see if this was put into your code by accident, got the same error as all of you! Nothing to do with some of these comments!
It also puts an erronous console import as well when i use console for the first time in a file!
Anyway, had the error, noticed the bad import at the top and now all ok!!!
Have you tried this? This solved my problem
- Right Click Libraries "Add Files to Project"
- /node_modules/react-native-gesture-handlers/ios/RNGestureHandler.xcodeproj
- Go to build phases and add libRNGestureHandler.a
- Run Good luck to you all!
Where do you do this? In XCode?
For other people, rebuilding and deploying from XCode solved this issue for me. I didn't realise that once you link, you need to re-build and deploy (which makes total sense now that I understand what linking is!)
Hi, I'm using
react-native-gesture-handler
withinreact-navigation
and getting this errornull is not an object ( evaluating 'RNGestureHandlerModule.Direction')
my project is just simple and using the latest release of react-native-gesture-handle
... "dependencies": { "react": "16.6.3", "react-native": "0.58.6", "react-native-gesture-handler": "^1.1.0", "react-navigation": "^3.3.2" }, ...
Seem it's related to Direction.js fix web compatibility #406Any suggestion for me to fix this?
Hi @blackpencil8994,
I also got this problem, but it can be run by react-native run-ios/android
. Could you run it with Metro Bundler?
I am getting the same error in android
After I followed the steps here https://reactnavigation.org/docs/en/getting-started.html
, I got the same issue and I solved it as follows:
1- Manually linking RNGestureHandler in Xcode (Apply @ajboxjr solution with the steps mentioned here https://facebook.github.io/react-native/docs/linking-libraries-ios
)
2- Uninstall the app
3- Rebuild and rerun the app using Xcode
Funcionou para mim no android! It worked for me on Android!
I am getting the same error in android
Have you solve this?
Have you tried this? This solved my problem
- Right Click Libraries "Add Files to Project"
- /node_modules/react-native-gesture-handlers/ios/RNGestureHandler.xcodeproj
- Go to build phases and add libRNGestureHandler.a
- Run Good luck to you all!
which libraries you are talking about?
in android、I resolved it by react-native start --reset-cache
So AFAIK it's just a matter of restarting and rebuilding.
On Android for this I used : react-native link react-native-gesture-handler after installed react-native-gesture-handler and I solve the problem.
For me just running react-native link command worked for me after re installing some libraries like react navigation
run in terminal react-native link react-native-gesture-handler
if not work check this guide https://reactnavigation.org/docs/en/getting-started.html
I faced with the same problem and this comment works for me 👍 https://github.com/kmagiera/react-native-gesture-handler/issues/494#issuecomment-471164413
If someone faced with the problem, please check your android/app/src/main/java/com/projectname/MainApplication.java
.
ok, in my case solved by adding:
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage; .... protected List<ReactPackage> getPackages() { // Add additional packages you require here // No need to add RnnPackage and MainReactPackage return Arrays.<ReactPackage>asList( .... new RNGestureHandlerPackage() ); }
to
android/app/src/main/java/com/projectname/MainApplication.java
I think I need to do the same, but I am trying to integrate RN in an existing project using this guideline and though I implement ReactApplication in my custom Application class and link the RNGH library through various gradle files, the getReactNativeHost() method of the ReactApplication interface never gets triggered, any ideas here ?
I have been successfully able to integrate it into my existing iOS App, any guidance on integrating in an existing Native Android app would be much helpful.
ok, in my case solved by adding:
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage; .... protected List<ReactPackage> getPackages() { // Add additional packages you require here // No need to add RnnPackage and MainReactPackage return Arrays.<ReactPackage>asList( .... new RNGestureHandlerPackage() ); }
to
android/app/src/main/java/com/projectname/MainApplication.java
Can you show me the mainactivity
I am finding the same issue on ios when running with react-native run-ios
. The app does run from the xcode workspace, however I need to have it running on a remote build server.
Has anyone in this situation been able to solve this issue?
Do maybe it’s a problem with linking on your remote server?
I don't think so.
Run Locally with Xcode: Works
Run Locally with react-native run-ios
: This error
Build Remotely Presumed this error (app crashes before I can get any diagnostics)
I have tried deleting build. The build succeeds when running react-native run-ios
however the simulator still loads with this null is not an object ( evaluating 'RNGestureHandlerModule.Direction')
error.
Pretty sure it's some kind of linking issue. Does react-native run-ios
look at different configs or something?
It does not have another config. But it has another cache
Funcionou para mim no android! It worked for me on Android!
Valeu irmão ! salvou hard hehe
I have solved this error by manually linking react-native-gesture-handler
as per React-Navigation setup guide
package com.sperapp;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "SperApp";
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
}
I had this issue with iOS when trying to get it running. After following the installation instructions and linking with
react-native link react-native-gesture-handler
I then had to run
pod install
Maybe the instructions need to be updated to reflect this if you are using pods?
Finally I did the same with new project and it worked for me.
So we need to manual linking
react-native-gesture-handler
with this new versionThank you all.
can you elaborate on this? were you trying to run on iOS or Android?
pod install
fixed my issue for iOS. Android was working fine after following the instructions at https://reactnavigation.org/docs/en/getting-started.html.
Here is what I saw:
Getting the same issue on android. using version 1.1.0
Followed all steps I could find here or on SO, unlinked, uninstalled then reinstalled and relinked. Followed https://reactnavigation.org/docs/en/getting-started.html and updated MainActivity.java file.
Restarted the build process, restarted the PC, ran gradlew clean
and still facing the issue.
Any help would be appreciated.
Thank me later:
yarn add react-native-gesture-handler
react-native link react-native-gesture-handler
react-native run-ios
No need for silly manual steps as above.
You're welcome!
Simply open xcode still dosent work, go to library and add a file, in file selector nevigate to genturehandler inside node module and then select that xcodeproject and then build basic, nevigate to library section and add the the module from library.
Have you tried this? This solved my problem
1. Right Click Libraries "Add Files to Project" 2. /node_modules/react-native-gesture-handlers/ios/RNGestureHandler.xcodeproj 3. Go to build phases and add libRNGestureHandler.a 4. Run Good luck to you all!
which IDE are you using? i am on vs code and i dont know where i should do this
@amrita6 you can link automatically in Android. But you need to manual link in iOS project. After install package, try this:
- Manual link for iOS project in XCode
- Rename ios folder into iosX
- Automatically link for Android by
react-native link react-native-gesture-handler
- Rename iosX folder into ios in turn
- Run
Hope this helps.
your solutaion very nice. Thank you.
And, I have question. Why did you rename the ios folder and link? And.. why linking work is not working well? How was this resolved? Thank you very much for your reply.
I suspect whether or not the pod install
works or does not will be related to which version of Cocoapods you are running
Hi, I'm using
react-native-gesture-handler
withinreact-navigation
and getting this errormy project is just simple and using the latest release of react-native-gesture-handle
... "dependencies": { "react": "16.6.3", "react-native": "0.58.6", "react-native-gesture-handler": "^1.1.0", "react-navigation": "^3.3.2" }, ...
Seem it's related to Direction.js fix web compatibility #406Any suggestion for me to fix this?