You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

  • 彻底清理项目缓存:
    1. 清理Metro缓存:npx react-native start --reset-cache
    2. Android项目清理:
      cd android
      ./gradlew clean
      cd ..
      
    3. iOS项目清理:
      cd ios
      pod deintegrate
      pod install
      cd ..
      
  • 检查项目入口文件(如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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 08:32:11