-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathApp.js
More file actions
68 lines (57 loc) · 1.79 KB
/
App.js
File metadata and controls
68 lines (57 loc) · 1.79 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// @flow
import React from 'react';
import { createStackNavigator } from 'react-navigation';
import { AppLoading, Font } from 'expo';
import LoginPage from './src/components/LoginPage';
import HomePage from './src/components/HomePage';
import ForgotPassword from './src/components/ForgotPassword';
import BalanceScreen from './src/components/BalanceScreen';
import OfferScreen from './src/components/OfferScreen';
import HKGroteskBold from './src/assets/fonts/HKGrotesk-Bold.ttf';
import HKGroteskLight from './src/assets/fonts/HKGrotesk-Light.ttf';
import HKGroteskMedium from './src/assets/fonts/HKGrotesk-Medium.ttf';
import HKGroteskRegular from './src/assets/fonts/HKGrotesk-Regular.ttf';
import HKGroteskSemiBold from './src/assets/fonts/HKGrotesk-SemiBold.ttf';
type Props = {};
type State = {
fontLoaded: boolean,
};
class App extends React.Component<Props, State> {
constructor() {
super();
this.state = {
fontLoaded: false,
};
}
state: State;
componentDidMount() {
this.loadAssets();
}
loadAssets = async () => {
await Font.loadAsync({
'HKGrotesk-bold': HKGroteskBold,
'HKGrotesk-light': HKGroteskLight,
'HKGrotesk-medium': HKGroteskMedium,
'HKGrotesk-regular': HKGroteskRegular,
'HKGrotesk-semi-bold': HKGroteskSemiBold,
});
this.setState({ fontLoaded: true });
};
render() {
const { fontLoaded } = this.state;
const Routes = createStackNavigator(
{
Login: { screen: LoginPage },
Home: { screen: HomePage },
ForgotPassword: { screen: ForgotPassword },
BalanceScreen: { screen: BalanceScreen },
OfferScreen: { screen: OfferScreen },
},
{
initialRouteName: 'Login',
},
);
return fontLoaded ? <Routes /> : <AppLoading />;
}
}
export default App;