I am trying to develop a project with React native. I'm new to React native. I am trying to create a membership page, I want the create account page to be opened when it is first opened, I want to redirect to the login page when the Login article is clicked, but I get the error navigator.navigate is not a function. These are the codes.
import { StatusBar } from "expo-status-bar";
import { Button, StyleSheet, Text, TextInput, View } from "react-native";
import { styles } from "./style.js";
import { Image, ImageBackground, Linking } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
const image = {
uri: "https://i.pinimg.com/originals/7a/cd/e2/7acde22c01c188cb008a3406c7bbc2a6.jpg",
};
export default function App() {
return (
<View style={styles.container}>
<ImageBackground source={image} resizeMode="cover" style={styles.image}>
<Text style={styles.createtext}>Create{"\n"}Account</Text>
<View style={styles.createarea}>
<TextInput style={styles.createinput} placeholder="Username" />
<TextInput style={styles.createinput} placeholder="Email" />
<TextInput style={styles.createinput} placeholder="Password" />
<TextInput
style={styles.createinput}
placeholder="Confirm Password"
/>
<Button title="Create Account" />
</View>
<Text style={{ textAlign: "center", marginTop: "5%" }}>
You already have an account?{" "}
<Text
onPress={() => navigator.navigate("Login")}
style={{ color: "blue" }}
>
Login
</Text>
</Text>
</ImageBackground>
<StatusBar style="auto" />
</View>
);
}