-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
43 lines (37 loc) · 1.12 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
import React from 'react';
import { StatusBar, View, AsyncStorage, Platform } from 'react-native';
import Constants from 'expo-constants'
import { parseDecks, createDecks } from '@utils/helper'
import { blue } from '@utils/colorNames'
import { MainNavigator } from '@utils/navigate';
function UdaciStatusBar({ backgroundColor, ...props }) {
return (
<View style={{ backgroundColor, height: Constants.statusBarHeight }}>
<StatusBar backgroundColor={backgroundColor} {...props} />
</View>
);
}
export default class App extends React.Component {
state = {
decks: []
}
componentDidMount() {
AsyncStorage.clear().then(() => {
createDecks().then(() => {
AsyncStorage.getAllKeys((err, keys) => {
AsyncStorage.multiGet(keys, (err, decks) => {
this.setState({ decks: parseDecks(decks) });
});
}).catch((e) => console.log(e));
})
});
}
render() {
return (
<View style={{ flex: 1 }}>
<UdaciStatusBar backgroundColor={blue} barStyle="light-content" />
<MainNavigator screenProps={this.state}/>
</View>
);
}
}