-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
85 lines (80 loc) · 2.1 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
import React, { useState, useEffect, useRef } from 'react'
import {
ActivityIndicator,
DrawerLayoutAndroid,
View,
Button,
Text,
StyleSheet,
StatusBar,
SafeAreaView
} from 'react-native'
import { NavigationContainer } from '@react-navigation/native'
import Tabs from './src/component/Tabs'
import * as Location from 'expo-location'
import { WEATHER_API_KEY } from '@env'
import { useGetWeather } from './src/hoosks/useGetWeather'
import { Feather } from '@expo/vector-icons'
import SideMenu from './src/component/SideMenu'
// import { createDrawerNavigator } from '@react-navigation/drawer';
// api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={API key}
// const Drawer = createDrawerNavigator();
const App = () => {
const [loading, errorMsg, weather] = useGetWeather()
const drawer = useRef(null)
const navigationView = () => (
<View style={[styles.sideMenu, styles.navigationContainer]}>
<SideMenu />
</View>
)
if (weather && weather.list) {
return (
<NavigationContainer>
<DrawerLayoutAndroid
ref={drawer}
drawerWidth={300}
drawerPosition={'left'}
renderNavigationView={navigationView}
>
<SafeAreaView style={{ flex: 1 }}>
<View
style={{
backgroundColor: 'purple',
alignContent: 'center',
justifyContent: 'center',
paddingHorizontal: 16
}}
>
</View>
<Tabs weather={weather} drawerpro={drawer} />
</SafeAreaView>
</DrawerLayoutAndroid>
</NavigationContainer>
)
}
return (
<View style={styles.container}>
<ActivityIndicator size={'large'} color={'blue'} />
</View>
)
}
const styles = StyleSheet.create({
container: {
justifyContent: 'center',
flex: 1
},
containerr: {
flex: 1,
padding: 16
},
navigationContainer: {
backgroundColor: '#fff'
},
sideMenu: {
flex: 1,
justifyContent: 'flex-start',
marginTop: StatusBar.currentHeight,
paddingTop: 10
}
})
export default App