我正在学习反应导航并面临抽屉导航的问题。
以下是我的代码和包详细信息。
package.json 中的依赖项
"@react-navigation/drawer": "^6.6.15",
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.9.26",
"react": "18.2.0",
"react-native": "0.74.1",
"react-native-gesture-handler": "^2.16.2",
"react-native-reanimated": "^3.12.0",
"react-native-safe-area-context": "^4.10.4",
"react-native-screens": "^3.31.1"
babel.config.js
module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: ['react-native-reanimated/plugin'],
};
代码
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {createDrawerNavigator} from '@react-navigation/drawer';
import Home from './Screens/Home';
const Drawer = createDrawerNavigator();
const Router = () => {
return (
<NavigationContainer>
<Drawer.Navigator>
<Drawer.Screen name="HomeScreen" component={Home} />
</Drawer.Navigator>
</NavigationContainer>
);
};
export default Router;
我收到错误为
错误:[Reanimated] 无法创建工作集。有关更多详细信息,请参阅 https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#failed-to-create-a-worklet。,js 引擎:herme
类型错误:无法读取未定义的属性“isConfigured”
我尝试删除节点模块并重新安装所有依赖项,也尝试过:
npx react-native run-ios -- --reset-cache
使用堆栈导航器时一切正常,但使用抽屉导航器时则无法工作。 请帮助我解决这个问题。我正在使用 M1 芯片 MacBook 并尝试在 iOS 模拟器上构建应用程序。
同样的错误。 rn 0.74.3 RN 复活 3.14.0.