This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
App.js
56 lines (50 loc) · 1.69 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
import React from 'react';
import {Platform, Text} from 'react-native';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {MainStack, OnboardingStack} from './routes';
import {navigationRef, routeNameRef, onStateChange} from './screens/tracker';
/// load locales, set defaults
import {Strings} from './lib';
import moment from 'moment';
import 'moment/locale/es';
import 'moment/locale/zh-cn';
moment.locale(Strings.getLanguage());
/// https://github.com/facebook/react-native/issues/15114
/// hack for Android phones with non-standard fonts
if (Platform.OS === 'android') {
const oldRender = Text.render;
Text.render = function (...args) {
const origin = oldRender.call(this, ...args);
return React.cloneElement(origin, {
style: [{fontFamily: 'roboto'}, origin.props.style],
});
};
}
const RootStack = createStackNavigator();
/// initialize first route
routeNameRef.current = 'Home';
const App: () => React$Node = () => {
return (
<SafeAreaProvider>
<NavigationContainer
ref={navigationRef}
onStateChange={state => onStateChange(state)}>
<RootStack.Navigator mode="modal">
<RootStack.Screen
name="MainStack"
component={MainStack}
options={{headerShown: false}}
/>
<RootStack.Screen
name="OnboardingStack"
component={OnboardingStack}
options={{headerShown: false, gestureEnabled: false}}
/>
</RootStack.Navigator>
</NavigationContainer>
</SafeAreaProvider>
);
};
export default App;