Last active
July 2, 2020 19:26
-
-
Save mrcflorian/411d266eaf5c081535692eaf0cf6f4b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'react-native-gesture-handler'; | |
import React, { useEffect, useState } from 'react' | |
import { NavigationContainer } from '@react-navigation/native' | |
import { createStackNavigator } from '@react-navigation/stack' | |
import { LoginScreen, HomeScreen, RegistrationScreen } from './src/screens' | |
import {decode, encode} from 'base-64' | |
if (!global.btoa) { global.btoa = encode } | |
if (!global.atob) { global.atob = decode } | |
const Stack = createStackNavigator(); | |
export default function App() { | |
const [loading, setLoading] = useState(true) | |
const [user, setUser] = useState(null) | |
return ( | |
<NavigationContainer> | |
<Stack.Navigator> | |
{ user ? ( | |
<Stack.Screen name="Home"> | |
{props => <HomeScreen {...props} extraData={user} />} | |
</Stack.Screen> | |
) : ( | |
<> | |
<Stack.Screen name="Login" component={LoginScreen} /> | |
<Stack.Screen name="Registration" component={RegistrationScreen} /> | |
</> | |
)} | |
</Stack.Navigator> | |
</NavigationContainer> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment