【发布时间】:2018-06-28 13:36:36
【问题描述】:
我目前正在开发一个 React Native 应用程序。 我正在使用 react-native-video:https://github.com/react-native-community/react-native-video
我找不到类似 onClick() 道具的东西。 为视频上的点击事件实现功能的最佳方式是什么?
【问题讨论】:
标签: react-native react-native-video
我目前正在开发一个 React Native 应用程序。 我正在使用 react-native-video:https://github.com/react-native-community/react-native-video
我找不到类似 onClick() 道具的东西。 为视频上的点击事件实现功能的最佳方式是什么?
【问题讨论】:
标签: react-native react-native-video
你应该像这样使用touchablehighlight:
class MyVideoComponent extends React.Component {
videoPressed() {
console.log("Video pressed");
}
render() {
return(
<TouchableHighlight
onPress={() => this.videoPressed()}
>
<YOURVIDEOCOMPONENT/>
</TouchableHighlight>
);
}
}
【讨论】: