使用样式时反应原生视频投掷"Render ErroR语言 Objects are not valid as a react child"



我收到这个错误:

对象作为React子对象无效(已找到:键为{position,top,left,bottom,right}的对象(。如果要渲染子对象的集合,请改用数组。

我只是想播放视频

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

const Post = () => {
const videoURL = 'https://d8vywknz0hvjw.cloudfront.net/fitenium-media-prod/videos/45fee890-a74f-11ea-8725-311975ea9616/processed_720.mp4'
return (
<View >
<Video source={{ uri: videoURL }}>
style={styles.backgroundVideo}
{/* onError={(e) => console.log(e)} */}
{/* resizeMode={'cover'} */}
</Video>
</View>
);
};
var styles = StyleSheet.create({
backgroundVideo: {
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
},
});

export default Post;

这与React Native Video Github中的示例相同我错过了什么?

我认为风格应该在视频组件内部,比如:

<Video source={{ uri: videoURL }} 
style={styles.backgroundVideo}
{/* onError={(e) => console.log(e)} */}
{/* resizeMode={'cover'} */}>
</Video>

相关内容

最新更新