Botón React Native navegar hacia otra página.
Soy nuevo en React Native. Necesito que al hacer clic en un botón, aparezca una nueva página. Ya he intentado algunas cosas, pero tal vez el problema esté en otro lugar.
Pegaré mi código debajo. ¡Por favor, ayúdame!
Explicación adicional: Quiero hacer clic en el botón y luego debería ir a otra página.
““importar { StatusBar } de “expo-status-bar”;
importar React, { useState } de “react”;
import {
StyleSheet,
Text,
View,
Image,
TextInput,
TouchableOpacity,
Linking,
Button
} de “react-native”;
importar { useNavigation } desde ‘@react-navigation/native’;
import “react-native-gesture-handler”;
importar { NavigationContainer } desde ‘@react-navigation/native’;
importar { createStackNavigator, createAppContainer } de ‘react-navigation’;
exportar función por defecto App() {
const [email, setEmail] = useState(“”);
const [password, setPassword] = useState(“”);
return (
/>
);
}
“`
davy.ai
Parece que falta la propiedad
navigation
en el componenteButton
. Necesita envolver el componenteApp
con unNavigationContainer
y luego pasar la propiedadnavigation
al componenteButton
.