import { View, ScrollView, StyleSheet, ActivityIndicator } from 'react-native'; import { useTheme, Text, Card } from 'react-native-paper'; import { useLocalSearchParams } from 'expo-router'; import { useEffect, useState } from 'react'; import { getLocation } from '@/api/locations'; export default function Location() { const theme = useTheme(); const { id } = useLocalSearchParams(); const [location, setLocation] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { const fetchLocation = async () => { try { const data = await getLocation(id) setLocation(data); } catch (error) { console.error("Error fetching location:", error); } finally { setLoading(false); } } fetchLocation(); }, [id]); if (loading) { return ( ); } if (!location) { return ( Brak lokalizacji - {id} ); } return ( {location.name} Opis: {location.description} Statystyki: Powierzchnia: {location.area} km² Ludność: {location.population} osób ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#25292e', justifyContent: 'center', alignItems: 'center', }, text: { color: '#fff', }, });