-
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.
- Loading branch information
Showing
9 changed files
with
328 additions
and
41 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,78 @@ | ||
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 DailyScreen({ weather }) { | ||
return null; | ||
import React, { useState, useEffect } from "react"; | ||
import { View, ScrollView, StyleSheet, FlatList } 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 DailyElement from "./components/DailyElement"; | ||
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 DailyScreen({ 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) { | ||
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.daily !== undefined ? ( | ||
<FlatList | ||
style={{ | ||
padding: 8, | ||
backgroundColor: theme.colors.background, | ||
display: "flex", | ||
marginBottom: 16, | ||
}} | ||
data={weather.daily} | ||
keyExtractor={(item) => item.dt.toString()} | ||
renderItem={({ item }) => { | ||
return <DailyElement x={item} theme={theme} t={t} />; | ||
}} | ||
/> | ||
) : ( | ||
<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, | ||
}, | ||
}); |
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
Oops, something went wrong.