Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location icon #42

Merged
merged 2 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions screens/aqi_screen/aqiPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const Aqi: FC<AQIScreenProps> = (props) => {
let { data, error, isLoading } = useLocation ? useGetLocationQuery(aqiLocation) : useGetAQIQuery(aqiCity);

const aqiInfo = data?.data;
let currentCity = aqiInfo?.city.name.split('-')[0]


const cityName = aqiCity.toUpperCase();

Expand Down Expand Up @@ -52,20 +54,20 @@ const Aqi: FC<AQIScreenProps> = (props) => {
</View>
)
}

return (
<View style={styles.container}>
<ImageBackground source={require("../../assets/air2.jpeg")} resizeMode="cover" style={{ width: "100%", height: "100%" }}>


<View style={styles.topNav}>
<Pressable
style={styles.backIcon}

onPress={() => props.navigation.navigate("Search")}
><Ionicons name="chevron-back-outline" size={36} color="black" /></Pressable>

<Pressable onPress={() => props.navigation.navigate("Search")}>
<Ionicons name="ios-search" size={32} color="black" />
<Pressable onPress={() => props.navigation.navigate("Search")} style={styles.searchIcon}>
<Ionicons name="ios-search" size={30} color="black" />
</Pressable>

<Pressable onPress={() => props.navigation.push('IndexPage')}>
Expand All @@ -75,7 +77,7 @@ const Aqi: FC<AQIScreenProps> = (props) => {


<Text style={styles.title}>AirOMeter</Text>
<Text style={styles.cityName}>{cityName}</Text>
<Text style={styles.cityName}>{aqiInfo ? currentCity : "N/A"}</Text>


<View style={styles.aqiCircle}>
Expand Down Expand Up @@ -166,26 +168,27 @@ const styles = StyleSheet.create({
alignContent: "center"
},
topNav: {
marginTop: 30,
marginTop: 65,
flexDirection: "row",
padding: 0,
height: 50
},
backIcon: {
alignItems: "flex-start",
marginRight: 275
height: 50,
justifyContent:'space-between'
},
searchIcon: {

alignItems: "flex-end",
marginLeft: 270,
marginTop:8
},

title: {
textAlign: "center",
marginTop: -10,
marginBottom: 5,
fontSize:25
},
cityName: {
textAlign: "center",
fontSize: 24,
fontSize: 20,
},
aqiCircle: {
alignSelf: "center",
Expand Down
9 changes: 7 additions & 2 deletions screens/search_screen/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import {
Pressable,
Alert,
} from "react-native";
import { Entypo } from '@expo/vector-icons';
import * as Location from "expo-location";


import { Ionicons } from "@expo/vector-icons";

import { NativeStackScreenProps } from "@react-navigation/native-stack";
Expand Down Expand Up @@ -39,8 +41,8 @@ const Search: FC<SearchScreenProps> = (props) => {
let userLocation = latitude + ";" + longitude;

// If user grants location access, switch over to using location data
setLocationLocal(userLocation);
dispatch(setLocation(location));
setLocationLocal(location);
dispatch(setLocation(userLocation));
dispatch(setUseLocationData(true));
props.navigation.push("Main");
}
Expand All @@ -62,6 +64,9 @@ const Search: FC<SearchScreenProps> = (props) => {

return (
<View style={styles.container}>
<Pressable onPress={getMyLocation} style={styles.locationIcon}>
<Entypo name="location-pin" size={24} color="black" />
</Pressable>
<Image style={styles.logo} source={require("../../assets/logo.png")} />
<Text style={styles.logoText}>AirOMeter</Text>
<View style={styles.inputContainer}>
Expand Down