-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
42 lines (33 loc) · 1004 Bytes
/
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
import React, { useState, useEffect } from "react";
import { ActivityIndicator, View, StyleSheet } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import Tabs from "./src/components/Tabs";
import * as Location from "expo-location";
import { WEATHER_API_KEY } from "@env";
import { useGetWeather } from "./src/hooks/useGetWeather";
// api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={API key}
const App = () => {
const [isLoading, errorMsg, weatherData] = useGetWeather()
if(weatherData && weatherData.list) {
return (
<NavigationContainer>
<Tabs weatherData={weatherData}/>
</NavigationContainer>
);
}
if(isLoading) {
return(
<View style={styles.container}>
<ActivityIndicator size="large" color="blue" />
</View>
)
}
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
});
export default App;