forked from akveo/react-native-ui-kitten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
75 lines (66 loc) · 1.89 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import React from 'react';
import {
StatusBar,
View,
Platform,
} from 'react-native';
import {
AppLoading,
Font,
} from 'expo';
import { StackNavigator } from 'react-navigation';
import * as Screens from './screens';
import { bootstrap } from './style/themeBootstrapper';
bootstrap();
const ExplorerApp = StackNavigator({
Home: { screen: Screens.ComponentsScreen },
Picker: { screen: Screens.PickerScreen },
Button: { screen: Screens.ButtonScreen },
Switch: { screen: Screens.SwitchScreen },
Choice: { screen: Screens.ChoiceScreen },
Tab: { screen: Screens.TabScreen },
Card: { screen: Screens.CardScreen },
Avatar: { screen: Screens.AvatarScreen },
Input: { screen: Screens.InputScreen },
Image: { screen: Screens.ImageScreen },
Gallery: { screen: Screens.GalleryScreen },
Settings: { screen: Screens.SettingsScreen },
ChoiceCustomization: { screen: Screens.ChoiceCustomizationScreen },
}, {
navigationOptions: {
headerStyle: {
backgroundColor: 'white',
marginTop: (Platform.OS === 'ios') ? 0 : Expo.Constants.statusBarHeight,
},
},
});
export default class App extends React.Component {
state = {
loaded: false,
};
componentWillMount() {
this.loadAssets().then(this.onAssetsLoaded);
}
loadAssets = async () => {
await Font.loadAsync({
'Roboto-Light': require('./fonts/Roboto-Light.ttf'),
'Roboto-Medium': require('./fonts/Roboto-Medium.ttf'),
Borg: require('./fonts/Borg.ttf'),
Curely: require('./fonts/Curely.ttf'),
FontAwesome: require('./fonts/FontAwesome.ttf'),
});
};
onAssetsLoaded = () => {
this.setState({ loaded: true });
};
renderLoading = () => (<AppLoading />);
renderApp = () => (
<View style={{ flex: 1 }}>
<ExplorerApp />
<StatusBar barStyle="default" />
</View>
);
render() {
return !this.state.loaded ? this.renderLoading() : this.renderApp();
}
}