我在另一个项目中遇到了问题,它指向了我正在使用的test导航抽屉,所以我决定打开一个测试文件,尝试重新创建这个问题。
我从ran导航网站复制代码并运行它,它给了我这个错误。
ERROR TypeError: undefined is not an object (evaluating 'InnerNativeModule.installCoreFunctions')
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling unmountApplicationComponentAtRootTag). A frequent cause of the error is that the application entry file path
is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
ialization error when loading React Native.
这是代码
import 'react-native-gesture-handler';
import * as React from 'react';
import { View, Text } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createDrawerNavigator } from '@react-navigation/drawer';
function Feed() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Feed Screen</Text>
</View>
);
}
function Article() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Article Screen</Text>
</View>
);
}
const Drawer = createDrawerNavigator();
function MyDrawer() {
return (
<Drawer.Navigator>
<Drawer.Screen name="Feed" component={Feed} />
<Drawer.Screen name="Article" component={Article} />
</Drawer.Navigator>
);
}
export default function App() {
return (
<NavigationContainer>
<MyDrawer />
</NavigationContainer>
);
}
这是我下载的软件包
"dependencies": {
"@react-navigation/drawer": "^6.1.8",
"@react-navigation/native": "^6.0.6",
"react": "17.0.2",
"react-native": "0.66.4",
"react-native-gesture-handler": "^2.1.1",
"react-native-reanimated": "^2.3.1",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.10.1"
},
我在网上看到,我可能忘了下载什么东西,但我能搞清楚
发布于 2022-01-16 09:17:41
因此~发生这种情况是因为没有正确安装react本机恢复(不变量冲突的常见原因:模块AppRegistry不是已注册的可调用模块),
要解决这个问题,只需按照react本机更新的网站https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/上的文档进行操作即可。
步骤1:在babel.config.js中
module.exports = {
...
plugins: [
...
'react-native-reanimated/plugin',//Add this
],
};
第二步:在android/app/build.gradle中
project.ext.react = [
enableHermes: true // <-change this to true
]
步骤3:在MainApplication.java中
import com.facebook.react.bridge.JSIModulePackage; // <- add
import com.swmansion.reanimated.ReanimatedJSIModulePackage; // <- add
...
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
...
@Override
protected String getJSMainModuleName() {
return "index";
}
///////////////////////////////////////////////////
@Override
protected JSIModulePackage getJSIModulePackage() { <- add this block
return new ReanimatedJSIModulePackage(); //
}
///////////////////////////////////////////////////
};
步骤4:在航站楼
cd android
./gradlew clean
cd ../
第五步:为了安全起见
npx react-native run-android -- --reset-cache
https://stackoverflow.com/questions/70710318
复制相似问题