简体   繁体   English

React Native,未定义不是 object(评估 '_reactNative.Image.propTypes.resizeMode')

[英]React Native, undefined is not an object (evaluating ‘_reactNative.Image.propTypes.resizeMode’)

I'm trying to render video in a React Native component using react-native-video v5.2.0 .我正在尝试使用 react-native-video v5.2.0在 React Native 组件中渲染视频。 I get following error.我收到以下错误。 I'm using react native CLI on OSX.我在 OSX 上使用 react native CLI。 The app crashes on trying to import the library, line:该应用程序在尝试导入库时崩溃,行:

import Video from 'react-native-video';

The error:错误:

Uncaught Error
undefined is not an object (evaluating ‘_reactNative.Image.propTypes.resizeMode’)

Screenshot:截屏:

在此处输入图像描述

The code:编码:

import React from 'react';
import {View, Text} from 'react-native';
import styles from './styles';

import Video from 'react-native-video';

const Post = () => {
  return (
    <>
      <View style={styles.container}>
        <Text>Post</Text>
        <Video
          source={{
            uri: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
          }} // Can be a URL or a local file.
          ref={ref => {
            this.player = ref;
          }} // Store reference
          onBuffer={this.onBuffer} // Callback when remote video is buffering
          onError={this.videoError} // Callback when video cannot be loaded
          style={styles.video}
        />
      </View>
    </>
  );
};

export default Post;

According to this GitHub issue , upgrading the version of react-native-video to "^6.0.0-alpha.1" would solve the problem:根据这个 GitHub 问题,将react-native-video的版本升级到"^6.0.0-alpha.1"可以解决问题:

npm i react-native-video@6.0.0-alpha.1

Don't hesitate to read the discussion there if it doesn't work for you.如果它不适合你,请不要犹豫阅读那里的讨论。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeError: undefined is not an object(评估'_reactNative.Image.propTypes.resizeMode') - TypeError: undefined is not an object (evaluating '_reactNative.Image.propTypes.resizeMode') TypeError:undefined 不是本机反应中的对象(正在评估“_reactNative.Stylesheet.create”) - TypeError: undefined is not an object (evaluating '_reactNative.Stylesheet.create') in react native 未定义不是对象(评估&#39;_react.PropTypes.object&#39;) - undefined is not an object (evaluating '_react.PropTypes.object') 错误 PropTypes React Native undefined is not an object(评估'_propTypes.default.nymber.isRequired') - Error PropTypes React Native undefined is not an object (evaluating '_propTypes.default.nymber.isRequired') React-Native-未定义不是对象(“评估_react3.default.PropTypes.shape”) - React-Native – undefined is not an object (“evaluating _react3.default.PropTypes.shape”) React-Native - undefined 不是一个对象(“评估 _react3.default.PropTypes.shape”) - React-Native - undefined is not an object (“evaluating _react3.default.PropTypes.shape”) 未定义不是对象(评估“React.PropTypes.Number”)错误 - Undefined is not an object (evaluating 'React.PropTypes.Number') error React Native Image Picker:“未定义不是对象(正在评估&#39;ImagePickerManager.showImagePicker&#39;)” - React Native Image Picker: “undefined is not an object (evaluating 'ImagePickerManager.showImagePicker')” ReactNative:未定义不是 object(评估“navigation.navigate”) - ReactNative: undefined is not an object (evaluating 'navigation.navigate') 在 Animated.Image 上 React Native 惊人的动画接收 TypeError: undefined is not an object (evaluating &#39;value.getValue&#39;) - React Native staggering animations on Animated.Image receives TypeError: undefined is not an object (evaluating 'value.getValue')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM