我收到此错误,有人可以帮忙吗?
import React from "react";
import { View, TouchableWithoutFeedback} from 'react-native';
import Video from 'react-native-video';
import styles from "./styles";
import { useState } from 'react';
const Post = () => {
const [paused, setPaused] = useState(false);
const onPlayPausePress = () => {
setPaused(!paused);
};
return (
<View style = {styles.container}>
<TouchableWithoutFeedback onPress={onPlayPausePress}>
{/* <> */}
<Video
source={{uri: "https://d8vywknz0hvjw.cloudfront.net/fitenium-media-prod/videos/45fee890-a74f-11ea-8725-311975ea9616/proccessed_720.mp4"}}
style={styles.video}
onError={(e) => console.log(e)}
resizeMode={"cover"}
repeat={true}
paused={paused}
/>
{/* </> */}
</TouchableWithoutFeedback>
</View>
);
}
export default Post;
import { StyleSheet,Dimensions } from "react-native";
const styles = StyleSheet.create({
container: {
width: '100%',
height: Dimensions.get('window').height,
},
video: {
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0
},
})
export default styles;
您好,我正在尝试添加单击时播放暂停的功能,但出现错误。
我尝试更改标签在网上寻找答案,但一无所获。
这是在 React Native 升级到 0.73 后发生的。您可以在以下主题中找到讨论。
https://github.com/TheWidlarzGroup/react-native-video/issues/3418
您可以通过删除导致此奇怪错误的 'TouchableWithoutFeedback' 来解决此问题。它可能会在下一个版本中修复。