-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added icons and hourly screen almost done.
Changed PTI calculation formula
- Loading branch information
Showing
46 changed files
with
666 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,6 @@ npm-debug.* | |
*.mobileprovision | ||
*.orig.* | ||
web-build/ | ||
|
||
API_KEY.js | ||
# macOS | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,81 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { Text, View, ScrollView } from 'react-native'; | ||
import { createMaterialBottomTabNavigator as createBottomTabNavigator } from '@react-navigation/material-bottom-tabs'; | ||
import { NavigationContainer } from '@react-navigation/native'; | ||
import { MaterialCommunityIcons } from '@expo/vector-icons'; | ||
import { IconButton, Searchbar } from 'react-native-paper'; | ||
export default function HourlyScreen({ weather }) { | ||
return null; | ||
} | ||
import React, { useState, useEffect } from "react"; | ||
import { View, ScrollView, StyleSheet } from "react-native"; | ||
import { MaterialCommunityIcons } from "@expo/vector-icons"; | ||
import iconMap from "./iconMap"; | ||
import { Text, ActivityIndicator, Divider, MD3LightTheme } from "react-native-paper"; | ||
import { calculatePTI } from "./utils/PTI"; | ||
import TopCurrent from "./components/TopCurrent"; | ||
import { FlexiCard } from "./components/Cards"; | ||
import moment from "moment"; | ||
import "moment/min/locales"; | ||
import HourlyElement from "./components/HourlyElement"; | ||
import * as Localization from "expo-localization"; | ||
import { RainComponent, UmbrellaIconReactive } from "./components/Bars"; | ||
//TODO: Add weather alerts | ||
moment.locale(Localization.locale.slice(0,2)); | ||
|
||
export default function HourlyScreen({ weather, location, t }) { | ||
//const theme = useTheme(); | ||
const theme = { | ||
...MD3LightTheme, | ||
}; | ||
const [weatherIcon, setWeatherIcon] = useState("help"); | ||
const [weatherIconColor, setWeatherIconColor] = useState( | ||
theme.dark ? iconMap["01d"].color_dark : iconMap["01d"].color | ||
); | ||
useEffect(() => { | ||
if (weather !== {} && weather.current !== undefined) { | ||
console.log(weatherIcon); | ||
setWeatherIcon( | ||
iconMap[weather.current.weather[0].icon].icon !== undefined | ||
? iconMap[weather.current.weather[0].icon].icon | ||
: "help" | ||
); | ||
setWeatherIconColor( | ||
theme.dark | ||
? iconMap[weather.current.weather[0].icon].color_dark !== undefined | ||
? iconMap[weather.current.weather[0].icon].color_dark | ||
: "00FFFF" | ||
: iconMap[weather.current.weather[0].icon].color !== undefined | ||
? iconMap[weather.current.weather[0].icon].color | ||
: "#FF0000" | ||
); | ||
} | ||
}); | ||
|
||
return weather.hourly !== undefined ? ( | ||
<ScrollView | ||
style={{ | ||
padding: 8, | ||
backgroundColor: theme.colors.background, | ||
display: "flex", | ||
marginBottom: 16, | ||
}} | ||
> | ||
{ | ||
weather.hourly.map((x, index) => { | ||
|
||
return <HourlyElement x={x} key={index} theme={theme} t={t} /> | ||
}) | ||
} | ||
</ScrollView> | ||
) : ( | ||
<View | ||
style={{ | ||
display: "flex", | ||
flex: 1, | ||
alignContent: "center", | ||
justifyContent: "center", | ||
}} | ||
> | ||
<ActivityIndicator size="large" color={theme.colors.primary} /> | ||
</View> | ||
); | ||
} | ||
const styles = StyleSheet.create({ | ||
border: { | ||
borderWidth: 1, | ||
borderColor: "#CAC4D0", | ||
borderRadius: 16, | ||
}, | ||
}); |
Oops, something went wrong.