[SOLVED] React Native – Expo update cause main no registered and tried to register two same name error

Issue

This Content is from Stack Overflow. Question asked by sathish

I have recently tried to update my React native application from expo 44 to 46 but it cause error

Here is my App.js

import React from 'react';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import ReduxThunk from 'redux-thunk';
import reducers from './src/reducers';
import Router from './src/Router';

export default class App extends React.Component {

  render() {
    const store = createStore(reducers, {}, applyMiddleware(ReduxThunk));
    return (
      <Provider store={store}>
        <Router />
      </Provider>
    );
  }
}

The error i am getting is:

Invariant Violation: Tried to register two views with the same name RNGestureHandlerButton
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.

Please find my github link



Solution

I believe expo docs are not clear on this:
Don’t install react-native-gesture-handler,
it already exists in Expo.

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.

Also, you can check errors on github instead of directly posting question: https://github.com/software-mansion/react-native-gesture-handler/issues/451


This Question was asked in StackOverflow by sathish and Answered by Priyanshu Chauhan It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?