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

React Native使用Video组件时出现“cannot read property of 'getViewManagerConfig' of null”错误求助

React Native使用Video组件时出现“cannot read property of 'getViewManagerConfig' of null”错误求助

大家好,我在React Native项目中使用Video组件时碰到了一个困扰很久的错误,报错内容为cannot read property of 'getViewManagerConfig' of null。以下是我的相关代码和问题细节,希望能得到大家的帮助:

Data是一个URL数组,maxResults是一个整数:

function VideoScreenWrapper({data, maxResults}){
  const videoRef = useRef([]);
  const onError = (error) => {
    console.log("Error: ", error);
  }
  console.log("Data in VideoScreenWrapper: ", data);
  if (data && data.length>0){
      return(
        <View>
          {data.slice(0, maxResults).map((item, index) => (
            
            <Video 
              key={index}  
              source={{ uri: item }}
              ref={el => videoRef.current[index] = el}
              onError={onError}
              //style={styles.backgroundVideo}
              resizeMode='cover'
              controls
            />
          ))}
        </View>
      );
    }else {
      return(
        <View>
          <Text> No data </Text>
        </View>
      );
  }
}

错误栈截图如下:
错误栈截图

我已经尝试过这些方法,但都没能解决问题:

  • 修改useRef的使用方式
  • 打印错误信息排查问题
  • 更换不同的Video组件库

备注:内容来源于stack exchange,提问作者Shayan Shamsipour

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.14 10:02:58