This repository was archived by the owner on Aug 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
56 lines (54 loc) · 1.54 KB
/
App.js
File metadata and controls
56 lines (54 loc) · 1.54 KB
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
import {
StyleSheet,
Text,
SafeAreaView,
Button,
Image,
TextInput,
TouchableOpacityBase,
} from "react-native";
import { useState, useEffect } from "react";
import { styles } from "./styles";
import WeatherScroll from "./weatherscroll";
import { searchAPI } from "./helpers";
const App = () => {
// hook declarations
const [city, setCity] = useState("");
return (
<SafeAreaView style={styles.head}>
<SafeAreaView style={styles.body}>
<WeatherScroll />
</SafeAreaView>
<SafeAreaView style={styles.head}>
<Text style={"fontSize:40"}>Find More Weather:</Text>
<Image source={require("./assets/favicon.png")} />
<TextInput
name="input"
placeholder="Enter your city"
multiline={false}
maxLength={20}
autoCapitalize={true}
autoComplete={true}
blurOnSubmit={true}
defaultValue={city}
onChangeText={(newcity) => setCity(newcity)}
></TextInput>
<Button
title="submit"
// after input finishes, the city variable will have the final input
onPress={() => {
if (typeof city !== "undefined") {
// search API function should call here to search for city weather on submit
searchAPI(city);
// for debugging, delete when done
console.log(city);
} else {
console.log("EMPTY INPUT");
}
}}
/>
</SafeAreaView>
</SafeAreaView>
);
};
export default App;