-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
80 lines (74 loc) · 2.23 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
76
77
78
79
80
import React from 'react';
import { StatusBar } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import './i18n';
import { I18nextProvider, useTranslation } from 'react-i18next';
import { LanguageProvider } from './contexts/LanguageContext';
import i18n from './i18n';
import HomeScreen from './src/Home';
import CalcScreen from './src/Calc';
import ResultScreen from './src/Result';
const Stack = createStackNavigator();
// 建立一個包裝的 Navigator 組件
function AppNavigator() {
const { t } = useTranslation();
return (
<Stack.Navigator initialRouteName="Home">
<Stack.Screen
name="Home"
component={HomeScreen}
options={() => ({
title: t('nav.home')
})}
/>
<Stack.Screen
name="Calc"
component={CalcScreen}
options={() => ({
title: t('nav.calc')
})}
/>
<Stack.Screen
name="Result"
component={ResultScreen}
options={() => ({
title: t('nav.result')
})}
/>
</Stack.Navigator>
);
}
export default function App() {
return (
<I18nextProvider i18n={i18n}>
<LanguageProvider>
<NavigationContainer>
<StatusBar hidden={false} />
<AppNavigator />
</NavigationContainer>
</LanguageProvider>
</I18nextProvider>
);
}
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
// | | \\\ - /// | |
// | \_| ''\---/'' |_/ |
// \ .-\__ '-' ___/-. /
// ___'. .' /--.--\ `. .'___
// ."" '< `.___\_<|>_/___.' >' "".
// | | : `- \`.;`\ _ /`;.`/ - ` : | |
// \ \ `_. \_ __\ /__ _/ .-` / /
// =====`-.____`.___ \_____/___.-`___.-'=====
// `=---='
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// 佛祖保佑 永無BUG