title: Invariant Violation: "main" has not been registered While running react-native app
body: <p>This is my folder structure. I have started this app with expo. Somehow i am not able to run it because of the following error.
  <a href="https://i.stack.imgur.com/OCJwE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OCJwE.png" alt="enter image description here" /></a></p>
  <p>Rootstack.js</p>
  <pre><code>import React from 'react';
  import { createSwitchNavigator } from 'react-navigation';
  import { createStackNavigator } from 'react-navigation-stack';
  
  
  import LoginComponent from &quot;../component/login/login&quot;;
  import HomeComponent from &quot;../component/home/home&quot;
  
  const AuthNav = createStackNavigator({
      Login:{
          screen : LoginComponent,
          navigationOptions:{
              headerShown: false
          }
      },
  });
  
  const AppNav = createStackNavigator({
      Home:{
          screen : HomeComponent,
          tabBarLabel: 'Home',
          navigationOptions:{
              headerShown: false
          }
      },
     
  });
  
  const switchNav = createSwitchNavigator({
      AuthNav,
      AppNav
  },{
      initialRouteName:&quot;AuthNav&quot;
  });
  
  
  export default switchNav;
  </code></pre>
  <p>App.js inside stack folder</p>
  <pre><code>import { createAppContainer } from 'react-navigation'
  import App from './stack/RootStack'
  import { AppRegistry } from 'react-native';
  AppRegistry.registerComponent('main',() =&gt; App);
  
  export default createAppContainer(App);
  
  </code></pre>
  <p>main app.js</p>
  <pre><code>import App from './src/App.js';
  export default App;
  </code></pre>
  <p>Error</p>
  <pre><code>Invariant Violation: Tried to register two views with the same name RNCSafeAreaProvider
  </code></pre>
  <p>Error 2</p>
  <pre><code>Invariant Violation: &quot;main&quot; 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.
  </code></pre>
  <p>Which part i am doing wrong here .</p>