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

升级Expo 47后React Native Reanimated报错:configureProps未定义

解决Reanimated configureProps 未定义的报错

核心原因

react-native-skeleton-content依赖的旧版Reanimated(2.1.0)使用了configureProps方法,但Reanimated 2.3.0+已移除该API,而Expo 47内置的Reanimated版本及你安装的2.13.0均属于移除该API的版本范围,导致依赖库调用了不存在的方法。

可行解决方案

  • 替换依赖库:放弃react-native-skeleton-content,改用兼容Reanimated 2.3+的骨架屏库,比如react-native-skeleton-content-nonexpo或@react-native-material/skeleton这类维护更活跃的库。
  • 手动patch依赖库:修改react-native-skeleton-content源码移除configureProps调用,再用补丁工具固化修改:
    1. 找到node_modules/react-native-skeleton-content/lib/SkeletonContent.js(或对应源码文件)
    2. 删除调用Reanimated.configureProps的代码块
    3. 运行npx patch-package react-native-skeleton-content生成补丁,确保后续安装依赖时自动应用修改
  • 锁定Reanimated兼容版本:Expo 47对应兼容的Reanimated版本是2.12.0,尝试降级并锁定依赖:
    npm install react-native-reanimated@2.12.0
    # 或 yarn add react-native-reanimated@2.12.0
    
    同时在package.json中配置版本锁定(npm用overrides,yarn用resolutions):
    // npm
    "overrides": {
      "react-native-skeleton-content": {
        "react-native-reanimated": "2.12.0"
      }
    }
    
    // yarn
    "resolutions": {
      "react-native-reanimated": "2.12.0"
    }
    
    之后删除node_modules和lock文件,重新安装依赖并重启Expo开发服务器。
  • 升级依赖库到兼容版本:检查react-native-skeleton-content是否有适配Reanimated API变更的新版本,若有直接升级:
    npm update react-native-skeleton-content
    # 或 yarn upgrade react-native-skeleton-content
    

内容的提问来源于stack exchange,提问作者LambentLight

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.08 12:40:55