React Native 0.69.12抽屉导航引发Reanimated依赖问题致应用无法加载
问题解决方案
针对 TypeError: undefined is not a constructor (evaluating 'new _reactNativeReanimated.default.Value(0)')
- 检查
react-native-reanimated版本与React Navigation抽屉导航的兼容性,确保使用Reanimated 2.x及以上版本 - 重新安装Reanimated依赖:
npm uninstall react-native-reanimated npm install react-native-reanimated - iOS环境执行pod安装:
npx pod-install - 重置Metro缓存:
npx react-native start --reset-cache
针对 Invariant Violation: Module AppRegistry is not a registered callable module
- 彻底清理项目缓存:
- 清理Metro缓存:
npx react-native start --reset-cache - Android项目清理:
cd android ./gradlew clean cd .. - iOS项目清理:
cd ios pod deintegrate pod install cd ..
- 清理Metro缓存:
- 检查项目入口文件(如
index.js),确保存在正确的App注册代码:import { AppRegistry } from 'react-native'; import App from './App'; import { name as appName } from './app.json'; AppRegistry.registerComponent(appName, () => App); - 重新安装所有项目依赖:
npm install
额外排查步骤
- 确认移除所有手动添加的配置后,
android/build.gradle、android/app/build.gradle以及MainApplication.java已恢复到修改前的状态 - 重启Metro服务和模拟器/真机
内容的提问来源于stack exchange,提问作者code46
相关产品推荐
相关产品推荐

