I have module where I need to use the stack navigator in the LoginScreen however when the user successfully login drawer navigator will implement instead of stack navigator. Right now i got an error it says.
functions are not valid as a React child. This may happen if you return a Component instead of from render. Or maybe you meant to call this function rather than return it.
What I have on my app.js
const Stack = createStackNavigator();
const Drawer = createDrawerNavigator();
const UnauthenticatedScreen = () => {
<Stack.Navigator>
<Stack.Screen
name="Login"
component={Login}
options=
{{
headerShown: false,
}}
/>
<Stack.Screen
name="Registration"
component={Register}
options={{
headerStyle: {
backgroundColor: '#4ABDFF'
},
headerTitleStyle: {
color: '#fff',
},
headerTintColor:'#fff',
}}
/>
<Stack.Screen
name="Privacy"
component={PrivacyPolicy}
options={{
headerStyle: {
backgroundColor: '#4ABDFF'
},
headerTitleStyle: {
color: '#fff',
},
headerTitle:'Privacy Policy',
headerTintColor:'#fff',
}}
/>
<Stack.Screen
name="RegistrationSuccess"
component={RegistrationSuccess}
options=
{{
headerShown: false,
}}
/>
</Stack.Navigator>
}
function AuthenticatedDriverScreen() {
<Drawer.Navigator initialRouteName="DriverDashboard">
<Drawer.Screen
name="DriverDashboard"
component={DriverDashboard}
options={{ drawerLabel: 'Home' }}
/>
</Drawer.Navigator>
}
function App() {
const isLogin = false;
return (
<NavigationContainer>
{isLogin ? AuthenticatedDriverScreen : UnauthenticatedScreen}
</NavigationContainer>
)
}
export default App;
Very well appreciated your help guys.