import { Link, Stack, useRouter } from 'expo-router'; import { useColorScheme } from 'react-native'; import { PaperProvider } from 'react-native-paper'; import { MD3LightTheme, MD3DarkTheme } from 'react-native-paper'; import Ionicons from '@expo/vector-icons/Ionicons'; import { deleteLocation } from '@/api/locations'; export default function RootLayout() { const colorScheme = useColorScheme(); const theme = colorScheme === 'dark' ? MD3DarkTheme : MD3LightTheme; const router = useRouter(); const handleDelete = (id) => { deleteLocation(id); while (router.canGoBack()) { router.back(); } router.replace('/'); }; return ( ({ title: "Lokalizacja", headerBackTitle: "Powrót", headerRight: () => ( ), })} /> ({ title: "Edycja", headerRight: () => ( handleDelete(route.params.id)} /> ), })} /> ); }