Created
March 2, 2022 09:25
-
-
Save matinzd/d10b7faba868b8a7ebe1a018f38ce0fb to your computer and use it in GitHub Desktop.
React navigation reproduction snack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import {View, Text, Button} from 'react-native'; | |
import {NavigationContainer} from '@react-navigation/native'; | |
import {createNativeStackNavigator} from '@react-navigation/native-stack'; | |
function HomeScreen({navigation}) { | |
return ( | |
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}> | |
<Text>Home Screen</Text> | |
<Button | |
title="Go to Details" | |
onPress={() => navigation.navigate('Details')} | |
/> | |
</View> | |
); | |
} | |
function DetailsScreen() { | |
return ( | |
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}> | |
<Text>Details Screen</Text> | |
</View> | |
); | |
} | |
const Stack = createNativeStackNavigator(); | |
function App() { | |
return ( | |
<NavigationContainer> | |
<Stack.Navigator> | |
<Stack.Screen name="Home" component={HomeScreen} /> | |
<Stack.Screen name="Details" component={DetailsScreen} /> | |
</Stack.Navigator> | |
</NavigationContainer> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment