File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ export function DetailsScreen({message = "Details Screen"}: DetailsScreenProps)
1111 return (
1212 < View style = { { flex : 1 , alignItems : 'center' , justifyContent : 'center' } } >
1313 < Text > { message } </ Text >
14- < Button onPress = { ( ) => navigation . navigate ( 'Home' ) } > Go Home</ Button >
14+ < Button onPress = { ( ) => navigation . push ( 'Details' ) } > Go Deeper</ Button >
15+ < Button onPress = { ( ) => navigation . goBack ( 'Details' ) } > Go Back</ Button >
16+ < Button onPress = { ( ) => navigation . popTo ( 'Home' ) } > Go Home</ Button >
1517 </ View >
1618 ) ;
1719}
Original file line number Diff line number Diff line change 1+ import { useNavigation } from '@react-navigation/native' ;
12import { View , Text } from 'react-native' ;
3+ import { Button } from '@react-navigation/elements' ;
24
35export type HomeScreenProps = {
46 message ?: string ;
57} ;
68
79export function HomeScreen ( { message = "Home Screen" } : HomeScreenProps ) {
10+ const navigation = useNavigation ( ) ;
11+
812 return (
913 < View style = { { flex : 1 , alignItems : 'center' , justifyContent : 'center' } } >
1014 < Text > { message } </ Text >
15+ < Button onPress = { ( ) => navigation . push ( 'Details' ) } > Go to Details</ Button >
1116 </ View >
1217 ) ;
1318}
You can’t perform that action at this time.
0 commit comments