Last active
September 11, 2017 18:15
-
-
Save diego3g/2f5265864a0e53df0bbb4c73f21ee68a to your computer and use it in GitHub Desktop.
This file contains 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 from 'react'; | |
import { View } from 'react-native'; | |
import { isSignedIn } from "./services/auth"; | |
import { createRootNavigator, SignedOutRoutes, SignedInRoutes } from './routes'; | |
export default class App extends React.Component { | |
state = { | |
signed: false, | |
signLoaded: false, | |
}; | |
componentWillMount() { | |
isSignedIn() | |
.then(res => this.setState({ signed: res, signLoaded: true })) | |
.catch(err => alert("Erro")); | |
} | |
render() { | |
const { signLoaded, signed } = this.state; | |
if (!signLoaded) { | |
return null; | |
} | |
const Layout = createRootNavigator(signed); | |
return <Layout />; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment