Skip to content

Instantly share code, notes, and snippets.

@alanfoandrade
Created June 23, 2021 11:27
Show Gist options
  • Save alanfoandrade/17754f7d0ad01ffed623a6ccc1d35a00 to your computer and use it in GitHub Desktop.
Save alanfoandrade/17754f7d0ad01ffed623a6ccc1d35a00 to your computer and use it in GitHub Desktop.
import React from 'react';
import { createStackNavigator } from '@react-navigation/stack';
import { useAuth } from '../hooks/auth';
import AuthRoutes from './auth.routes';
import AppRoutes from './app.routes';
const Stack = createStackNavigator();
const Routes: React.FC = () => {
const { user } = useAuth();
return user ? (
<Stack.Navigator>
<Stack.Screen
name="AppRoutes"
component={AppRoutes}
options={{
headerShown: false,
}}
/>
</Stack.Navigator>
) : (
<Stack.Navigator>
<Stack.Screen
name="AuthRoutes"
component={AuthRoutes}
options={{
headerShown: false,
}}
/>
</Stack.Navigator>
);
};
export default Routes;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment