Last active
November 4, 2019 05:56
-
-
Save philipshen/06d26418fabdcbb30d7b88aaff6216d5 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, { Component } from 'react' | |
| import { ActivityIndicator, View } from 'react-native' | |
| import { NavigationAction, NavigationScreenProp } from 'react-navigation' | |
| interface Props { | |
| navigation: NavigationScreenProp<NavigationAction, any> | |
| } | |
| export default class AuthLoadingScreen extends Component<Props, {}> { | |
| constructor(props) { | |
| super(props) | |
| this.verifyAuthenticationAndNavigate() | |
| } | |
| render() { | |
| return ( | |
| <View style={{flex: 1, justifyContent: "center", alignItems: "center"}}> | |
| <ActivityIndicator /> | |
| </View> | |
| ) | |
| } | |
| async verifyAuthenticationAndNavigate() { | |
| const isAuthenticated = await firebase.auth().currentUser().isAuthenticated | |
| this.props.navigation.navigate(isAuthenticated ? 'Main' : 'Auth') | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment