1// In App.js in a new project
2
3import * as React from 'react';
4import { View, Text } from 'react-native';
5import { NavigationContainer } from '@react-navigation/native';
6import { createStackNavigator } from '@react-navigation/stack';
7
8function HomeScreen() {
9 return (
10 <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
11 <Text>Home Screen</Text>
12 </View>
13 );
14}
15
16const Stack = createStackNavigator();
17
18function App() {
19 return (
20 <NavigationContainer>
21 <Stack.Navigator>
22 <Stack.Screen name="Home" component={HomeScreen} />
23 </Stack.Navigator>
24 </NavigationContainer>
25 );
26}
27
28export default App;