I try to create navigation with { createStackNavigator, createAppContainer } from \'react-navigation\' but when a start my application i always receive error
I try a lo
I am not using expo and I had the same problem. I fixed it by going into my "package-lock.json" file and find "react-native-gesture-handler" and removed the whole package with dependencies. After this, in node_modules folder I deleted the folder named "react-native-gesture-handler". now, npm install react-native-gesture-handler worked for me.
If you are NOT using expo and saw this error, then you may be using a component which return's a TouchableOpacity. You may get the same error and several script bundling will also happen. To fix that wrap the TouchableOpacity within a View.
If you are using Expo to build your react native app you do not have to import react-native-gesture-handler from npm or yarn. It is already in the expo package. If you import the package you will experience this error.
going off of @Andrew's answer, the issue may sometimes even be a little subtler than an extraneous manual install of react-native-gesture-handler: for me, i found out that a package i updated recently included their own copy of react-native-gesture-handler as a dependency (found out by doing a search through my yarn.lock, package-lock.json, node_modules, etc.) - so i had to downgrade that package to a version that wasn't dependent on react-native-gesture-handler..
For anyone else who gets here searching for:
"Unable to resolve "react-native-gesture-handler" from "node_modules@react-navigation\native\src\Scrollables.js""
I found the answer here:
https://github.com/expo/expo/issues/5107
If you're using Expo SDK 34+, despite what older threads says, you need to run the following to get it working:
expo install react-native-gesture-handler
Note this answer was written for Expo v33. Please check with the current documentation for react-navigation and the version of Expo that you are using for up-to-date installation instructions.
The reason for your error is that you are using react-navigation in your Expo app, however you have followed the tutorial incorrectly.
https://reactnavigation.org/docs/en/getting-started.html
If you read the instructions it tells you that once you have installed react-navigation you should then install react-native-gesture-handler. However that is not what they say
Next, install react-native-gesture-handler. If you’re using Expo you don’t need to do anything here, it’s included in the SDK.
It says that if you are using Expo you do not need to install react-native-gesture-handler as it is already installed.
You are getting errors because you have installed react-native-gesture-handler, it already exists in Expo, and Expo is getting confused about where to get its information from.
To solve your problem do the following.
ExpoExpoExpo app on your device.package-lock.jsonnode_modules folderreact-native-gesture-handler entry from your package.jsonnpm iExpo using expo start -cBe careful when using Expo it is easy to install dependencies that cannot run with it, and cause yourself issues like this.