added main
This commit is contained in:
5
20250327/my-app/app/_layout.tsx
Normal file
5
20250327/my-app/app/_layout.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Stack } from "expo-router";
|
||||
|
||||
export default function RootLayout() {
|
||||
return <Stack />;
|
||||
}
|
||||
43
20250327/my-app/app/index.jsx
Normal file
43
20250327/my-app/app/index.jsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { View, Text, TextInput, Button, FlatList, StyleSheet, Alert } from "react-native";
|
||||
|
||||
const baseUrl = "http://api.weatherapi.com/v1/current.json?key=1232eaa82978466da1f81125252703&q=";
|
||||
|
||||
export default function Index() {
|
||||
const [city, setCity] = useState("");
|
||||
|
||||
|
||||
const handlePress = () => {
|
||||
console.log(city);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchData() {
|
||||
try {
|
||||
const response = await fetch(`${baseUrl}Békéscsaba`);
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Text>
|
||||
Időjárás app
|
||||
</Text>
|
||||
<Button
|
||||
title="Keresés"
|
||||
onPress={handlePress} />
|
||||
<TextInput
|
||||
placeholder="Város"
|
||||
value={city}
|
||||
onChangeText={setCity} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user