You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native视频播放暂停功能报错求助:-[RCTVideo setOnClick:]无法识别

问题:点击视频切换播放/暂停时触发Selector未识别错误

我在实现点击视频切换播放/暂停状态的功能时出现报错,错误信息如下:

Exception thrown while executing UI block: -[RCTVideo setOnClick:]: unrecognise selector sent to instance

我已经尝试修改标签,也在网上查找过解决方案但都没有效果,以下是我的代码:

Post组件代码

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/processed_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;

内容的提问来源于stack exchange,提问作者e36_King

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 04:49:55