Add react native js components

This commit is contained in:
Jannis Mattheis
2018-05-12 21:00:29 +02:00
committed by Jannis Mattheis
parent c3743cde25
commit ea20a6418d
6 changed files with 220 additions and 0 deletions

26
src/AuthLoading.js Normal file
View File

@@ -0,0 +1,26 @@
import React from 'react';
import {
ActivityIndicator,
AsyncStorage,
StatusBar,
StyleSheet,
View,
} from 'react-native';
import SharedPreferences from 'react-native-shared-preferences';
export default class AuthLoadingScreen extends React.Component {
componentDidMount() {
SharedPreferences.getItem('@global:token', (token) => {
this.props.navigation.navigate(token ? 'Messages' : 'Login');
});
}
render() {
return (
<View >
<ActivityIndicator />
<StatusBar barStyle="default" />
</View>
);
}
}