-
Notifications
You must be signed in to change notification settings - Fork 2
/
App.js
95 lines (80 loc) · 2.57 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { StyleSheet, Text, View } from 'react-native';
import { NativeBaseProvider, extendTheme } from 'native-base';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { configureStore } from "@reduxjs/toolkit";
import { Provider } from "react-redux";
import mainReducer from './src/redux';
import { useFonts, Montserrat_400Regular } from "@expo-google-fonts/montserrat";
import { Damion_400Regular } from "@expo-google-fonts/damion";
import axios from 'axios';
import Constants from 'expo-constants'
import Home from './src/Components/Home';
import Plant from './src/Components/PlantInfo';
import HistoryLog from './src/Components/History';
import Log from './src/Components/Log';
// import { Amplify } from 'aws-amplify';
// import awsExports from './src/aws-exports';
// Amplify.configure(awsExports);
// import { withAuthenticator } from '@aws-amplify/ui-react-native';
const Stack = createNativeStackNavigator();
let mainStore = configureStore({
reducer: mainReducer
})
const API_URL = Constants.manifest.extra.API_URL
function App() {
const getData = async () => {
console.log('from the URL', API_URL);
try {
const response = await axios.get(API_URL);
console.log('data from the request', response.data);
} catch (error) {
console.error(error);
}
};
// getData();
const [fontsLoaded] = useFonts({
Montserrat_400Regular,
Damion_400Regular
})
if (!fontsLoaded) {
return null;
}
const navigatorStyleOptions = {
headerStyle: {
backgroundColor: 'rgba(0, 151, 178, 1)',
},
headerTitleAlign: 'center',
headerTintColor: 'white',
headerTitleStyle: {
fontFamily: 'Montserrat_400Regular'
},
}
return (
<Provider store={mainStore} >
<NavigationContainer>
<NativeBaseProvider>
<Stack.Navigator
initialRouteName='Home'
screenOptions={navigatorStyleOptions}
>
<Stack.Screen name='Home' component={Home} />
<Stack.Screen name='Plant' component={Plant} />
<Stack.Screen name='History' component={HistoryLog} />
<Stack.Screen name='Log' component={Log} />
</Stack.Navigator>
</NativeBaseProvider>
</NavigationContainer>
</Provider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
export default App;
// export default withAuthenticator(App);