Asked 5 years ago
23 Sep 2019
Views 1046
jagdish

jagdish posted

React Native - Navigation prop is missing

i am trying something for react-native navigation




import React, {Fragment} from 'react';
import {
  SafeAreaView,
  StyleSheet,
  ScrollView,
  View,
  Text,
  StatusBar,
} from 'react-native';

 
import { createSwitchNavigator, createStackNavigator }  from 'react-navigation';
import Login from "./src/screens/Login";
 import Signup from "./src/screens/Signup";


const MySwitchNavigator = createSwitchNavigator(
  {
  Signin: Login,
  Register: Signup
   },
  {
    initialRouteName: 'Signin',
  }
);  
const App = () => {
  return (
    <MySwitchNavigator />
  );
};
 
export default App;



and i am getting error as below

Invariant Violation: The navigation prop is missing for this navigator. In react-navigation 3 you must set up your app container directly. 

This error is located at:
    in Navigator (at App.js:36)
    in App (at renderApplication.js:40)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:98)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:115)
    in AppContainer (at renderApplication.js:39)
duglus

duglus
answered Nov 30 '-1 00:00

try to add react-navigation again
or
start React Native again . and reset cache.
 npm run start -- -- reset-cache 
it

Post Answer