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

React Native Expo嵌入Unity报错:ViewManagerResolver返回RNUnity/RCTRNUnityView空值

React Native Expo嵌入Unity时ViewManagerResolver返回null的问题

配置详情

  • React Native Expo版本:通过npx create-expo-app@latest创建
  • Unity版本:2022.3.42f1
  • React Native Unity包版本:最新版(同时尝试过教程推荐的1.0.7版本)
  • Unity构建路径:导出至React Native项目根目录下的unity/builds/android

执行步骤

  1. 将Unity项目导出至unity/builds/android路径
  2. 创建UnityScreen.tsx文件,代码如下:
import React, { useRef } from 'react';
import UnityView from '@azesmway/react-native-unity';
import { View } from 'react-native';

const Unity = () => {
  const unityRef = useRef<UnityView>(null);

  return (
    <View style={{ flex: 1 }}>
      <UnityView
        ref={unityRef}
        style={{ flex: 1 }}
      />
    </View>
  );
};

export default Unity;
  1. 将该页面添加至导航栈
  2. 使用npx expo start启动应用

问题现象

应用初始运行正常,但点击按钮导航至Unity页面时,出现错误:

ViewManagerResolver returns null for either RNUnity or RCTRNUnityView

已尝试方案

  • 严格遵循react-native-unity的GitHub README配置步骤
  • 按照Medium教程完成操作
  • 切换至教程推荐的1.0.7版本react-native-unity

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.15 13:42:10