我想做一个简单的任务,就是从一个屏幕跳转到另一个屏幕,但无论我做什么都不起作用。我已经安装了 react-navigation/stack 和 react-navigation/native-stack,但它们都不能与我现有的代码一起工作,是因为标签页吗?
import { NavigationContainer } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; import Tabs from './navigation/tabs'; import "react-native-url-polyfill/auto" import LogInSignUp from './SettingsScreen/LogInSignUp'; const Stack = createStackNavigator(); const App = () => { return (); }; export default App; import { Text, StyleSheet, View, Button, } from "react-native"; import { StatusBar } from "expo-status-bar"; const Settings = (navigation) => { return ( ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, }) export default Settings import React from 'react' import { StackActions } from '@react-navigation/native'; const LogInSignUp = (navigation) => { return ( LogInSignUp) } export default LogInSignUp
我尝试查找解释这个问题的教程,他们所有的代码看起来都像我的代码,只是将名称更换为我的 .js 文件,但什么都不起作用。
你试过这个钩子吗
const navigation = useNavigation();