React Native - 任何人都可以帮助我为什么会收到此错误吗?

问题描述 投票:0回答:1

我收到此错误,有人可以帮忙吗?

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;

在此输入图片描述

您好,我正在尝试添加单击时播放暂停的功能,但出现错误。

我尝试更改标签在网上寻找答案,但一无所获。

javascript reactjs react-native
1个回答
0
投票

这是在 React Native 升级到 0.73 后发生的。您可以在以下主题中找到讨论。

https://github.com/TheWidlarzGroup/react-native-video/issues/3418

您可以通过删除导致此奇怪错误的 'TouchableWithoutFeedback' 来解决此问题。它可能会在下一个版本中修复。

© www.soinside.com 2019 - 2024. All rights reserved.