-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
61 lines (52 loc) · 1.85 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
import "react-native-gesture-handler";
import React, { useState, useEffect } from "react";
import { StatusBar } from "expo-status-bar";
import AppLoading from "expo-app-loading";
import Amplify from "aws-amplify";
import { withAuthenticator } from "aws-amplify-react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import * as Font from "expo-font";
import { Ionicons } from "@expo/vector-icons";
import { StyleProvider } from "native-base";
import awsconfig from "./src/aws-exports";
import getTheme from "./native-base-theme/components";
import platform from "./native-base-theme/variables/platform";
import HomeScreen from "./src/views/HomeScreen";
import SettingsScreen from "./src/views/SettingsScreen";
import StyledTabNavigator from "./src/components/StyledTabNavigator";
Amplify.configure({
...awsconfig,
// Disabling Analytics to prevent error message about missing credentials
// https://github.com/aws-amplify/amplify-js/issues/5918
Analytics: {
disabled: true,
},
});
const Tab = createBottomTabNavigator();
const App = () => {
const [isReady, setIsReady] = useState(false);
useEffect(() => {
Font.loadAsync({
Roboto: require("native-base/Fonts/Roboto.ttf"),
Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf"),
...Ionicons.font,
});
setIsReady(true);
}, []);
if (!isReady) {
return <AppLoading />;
}
return (
<StyleProvider style={getTheme(platform)}>
<NavigationContainer>
<StyledTabNavigator tab={Tab}>
<Tab.Screen name="Home" component={HomeScreen} />
<Tab.Screen name="Settings" component={SettingsScreen} />
</StyledTabNavigator>
<StatusBar hidden />
</NavigationContainer>
</StyleProvider>
);
};
export default withAuthenticator(App);