-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
50 lines (45 loc) · 1.44 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import React, { useState } from 'react';
import AppLoading from 'expo-app-loading';
import MainNavigation from './src/navigation/MainNavigation';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { CredentialsContext } from './src/components/CredentialsContext';
import { ImageBackground, StyleSheet } from 'react-native';
const imageSource = require('./src/images/background.jpg')
export default function App() {
const [appReady, setAppReady] = useState(false);
const [storedCredentials, setStoredCredentials] = useState('');
const checkLoginCredentials = () => {
AsyncStorage.getItem('@register_key')
.then(result => {
if (result !== null) {
setStoredCredentials(JSON.stringify(result));
} else {
setStoredCredentials(null);
}
})
.catch(error => console.log(error));
};
// if (!appReady) {
// return (
// <AppLoading
// startAsync={checkLoginCredentials}
// onFinish={() => setAppReady(false)}
// onError={console.warn}
// />
// );
// }
return (
<ImageBackground source={imageSource} style={styles.backgroundImage} resizeMode='cover'>
<CredentialsContext.Provider value={{ storedCredentials }}>
<MainNavigation />
</CredentialsContext.Provider>
</ImageBackground>
);
}
const styles = StyleSheet.create({
backgroundImage: {
flex: 1,
height: '100%',
width: '100%',
}
})