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

首次EAS iOS构建遇RNSScreen未在UIManager中找到错误求助

解决EAS构建iOS时RNSScreen找不到的问题

针对你运行eas build --profile development --platform ios时出现的Invariant Violation: requireNativeComponent: "RNSScreen" was not found in the UIManager错误,尝试以下步骤:

  • 强制启用react-native-screens原生支持
    在项目入口文件(App.tsx或index.js)的最顶部添加以下代码,确保原生模块被初始化:

    import { enableScreens } from 'react-native-screens';
    enableScreens();
    

    这是react-navigation依赖react-native-screens的必要配置,缺失会导致原生组件无法被识别。

  • 清除本地与远程构建缓存

    1. 清除Expo本地缓存:
      npx expo start --clear
      
    2. 清除EAS远程构建缓存,强制重新拉取所有依赖构建:
      eas build --profile development --platform ios --clear-cache
      
  • 重新生成原生配置文件(仅Expo Managed工作流)
    如果是Expo托管项目,运行以下命令重新生成iOS原生目录配置,修复可能的Pod依赖问题:

    npx expo prebuild --clean
    

    执行完成后再重新触发EAS构建。

  • 检查expo-build-properties插件配置
    打开app.json或app.config.js,确认expo-build-properties插件没有排除react-native-screens相关的Pod依赖,例如不要出现类似以下的配置:

    "plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "podsToExclude": ["RNSScreen"]
          }
        }
      ]
    ]
    
  • 确认导航容器的包裹结构
    确保你的导航容器被GestureHandlerRootView正确包裹,避免导航组件加载异常:

    import { GestureHandlerRootView } from 'react-native-gesture-handler';
    import { NavigationContainer } from '@react-navigation/native';
    
    export default function App() {
      return (
        <GestureHandlerRootView style={{ flex: 1 }}>
          <NavigationContainer>
            {/* 你的导航栈/标签栏结构 */}
          </NavigationContainer>
        </GestureHandlerRootView>
      );
    }
    

按顺序执行以上步骤后,重新运行EAS构建命令,一般能解决RNSScreen未找到的问题。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.05 00:36:19