import {useState} from 'react';
import { Button, View, Text, TextInput } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
function HomeScreen({ navigation }) {
const [text, setText] = useState("");
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Home Screen</Text>
<Text>{text}</Text>
<Button
title="Go to Details"
onPress={() => navigation.navigate('Details', {thing: text})
}
/>
<TextInput onChangeText={newText => setText(newText)} defaultValue="" />
</View>
);
}
function DetailsScreen({ navigation, route }) {
const { thing } = route.params;
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Details Screen {thing} </Text>
<Button
title="Go to Details... again"
onPress={() => navigation.navigate('Details', {thing: 'aaaaa'})}
/>
</View>
);