Skip to content

Instantly share code, notes, and snippets.

@diego3g
Last active September 11, 2017 18:15
Show Gist options
  • Save diego3g/2f5265864a0e53df0bbb4c73f21ee68a to your computer and use it in GitHub Desktop.
Save diego3g/2f5265864a0e53df0bbb4c73f21ee68a to your computer and use it in GitHub Desktop.
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