Доброго времени суток! Изучаю реакт нетив. Смотрю видео уроки. Не получается сделать переход между окнами вроде все по видео делал ошибок не выдает
React Navigation
App.js
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import MainStack from './navigate';
import { NavigationContainer } from '@react-navigation/native';
export default function App() {
return (
<View style={styles.container}>
<Text>dsdfdsf</Text>
<MainStack />
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
navigate.js
import React from "react";
import Main from "./components/Main";
import Authentication from "./components/Authentication";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
const Stack = createNativeStackNavigator();
export default function navigate(){
return <NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="Main"
component={Main}
options={{title: 'qwqdqdqwdwqd'}}
/>
<Stack.Screen
name="Authentication"
component={Authentication}
options={{title: 'saascasacsac'}}
/>
</Stack.Navigator>
</NavigationContainer>;
}
main.js
import React from "react";
import { StyleSheet, Text, View, Button } from 'react-native';
export default function Main({navigation}) {
const loadScene = () => {
navigation.navigate('Authentication')
}
return (
<View style={styles.container}>
<Text>Main</Text>
<Button title='Open page' onPress={loadScene}/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});