[英]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.