Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tried to register two views with the same name RNGestureHandlerButton

Tags:

react-native

I try to create navigation with { createStackNavigator, createAppContainer } from 'react-navigation' but when a start my application i always receive error

I try a lot of thing and i don't find any documentation/help on this

This is my package.json

{ 
  "main": "node_modules/expo/AppEntry.js", 
  "scripts": { 
    "start": "expo start", 
    "android": "expo start --android", 
    "ios": "expo start --ios", 
    "eject": "expo eject" 
    }, 
  "dependencies": { 
    "expo": "^32.0.0", 
    "react": "16.5.0", 
    "react-native": "github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
     "react-native-gesture-handler": "^1.0.15", 
    "react-navigation": "^3.0.9" 
    }, 
  "devDependencies": { 
    "babel-preset-expo": "^5.0.0" 
    }, 
  "private": true 
}
like image 411
user3362330 Avatar asked Feb 01 '19 20:02

user3362330


People also ask

Which threw an exception invariant violation tried to register two views with the same name RNDateTimePicker?

ERROR Invariant Violation: Tried to register two views with the same name RNDateTimePicker ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.

Where do I put GestureHandlerRootView?

with gesture handlers, the handlers need to be mounted under a single GestureHandlerRootView . So it's important to keep the GestureHandlerRootView as close to the actual root view as possible.


1 Answers

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.

  1. Close all terminals running Expo
  2. Close the browser window running Expo
  3. Clear the project you were working on from the Expo app on your device.
  4. Delete your package-lock.json
  5. Delete your node_modules folder
  6. Remove the react-native-gesture-handler entry from your package.json
  7. Run npm i
  8. Restart Expo using expo start -c

Be careful when using Expo it is easy to install dependencies that cannot run with it, and cause yourself issues like this.

like image 111
Andrew Avatar answered Oct 06 '22 08:10

Andrew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!