-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.tsx
52 lines (48 loc) · 1.89 KB
/
App.tsx
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
import { NotoSansJP_400Regular, useFonts } from '@expo-google-fonts/noto-sans-jp';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer } from '@react-navigation/native';
import { NativeBaseProvider } from "native-base";
import * as SplashScreen from 'expo-splash-screen';
import { Ionicons } from '@expo/vector-icons';
import React, { useState, useEffect } from 'react';
import { ConfigurationContext } from './src';
import { HomeScreen, SettingScreen } from './src/screens';
import { Configuration } from './src/services/VoicevoxService';
import { useEvent } from 'react-native-reanimated';
const Tab = createBottomTabNavigator();
export default function App() {
const [fontsLoaded] = useFonts({ NotoSansJP_400Regular });
const [config, setConfig] = useState<Configuration>({} as Configuration);
useEffect(() => {
!fontsLoaded
? SplashScreen.preventAutoHideAsync()
: SplashScreen.hideAsync()
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
} else {
return (
<ConfigurationContext.Provider
value={{ config: config, setConfig: setConfig }}>
<NavigationContainer>
<NativeBaseProvider>
<Tab.Navigator
initialRouteName='Settings'
screenOptions={({ route }) => ({
tabBarIcon: ({ color, size }) => {
if (route.name === 'Settings') {
return <Ionicons name='settings' size={size} color={color} />;
}
return <Ionicons name='home' size={size} color={color} />;
},
})}
>
<Tab.Screen name='Home' component={HomeScreen} />
<Tab.Screen name='Settings' component={SettingScreen} />
</Tab.Navigator>
</NativeBaseProvider>
</NavigationContainer>
</ConfigurationContext.Provider>
);
}
}