Skip to content

Commit

Permalink
fix(video): wrap video into TouchableWithoutFeedback to detect onPress
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatanSalas committed Nov 7, 2020
1 parent ee07dee commit 39a6684
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions src/components/StoryDetailItem/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import Video from 'react-native-video';
import { ActivityIndicator } from 'react-native';
import { ActivityIndicator, TouchableWithoutFeedback } from 'react-native';

import type { StoryDetailItemProps } from '../../types';

Expand Down Expand Up @@ -69,21 +69,24 @@ export const StoryDetailItem: React.FC<StoryDetailItemProps> = React.memo(
style={styles.indicator}
/>
)}
<Video
ref={videoRef}
muted={muted}
controls={false}
resizeMode="cover"
style={styles.container}
source={getVideoSource(story)}
paused={paused}
onLoadStart={onLoadStart}
onLoad={onLoad}
onProgress={onProgress}
onEnd={onEnd}
onTouchStart={onTouchStart}
onTouchEnd={onTouchEnd}
/>
<TouchableWithoutFeedback
onPressIn={onTouchStart}
onPressOut={onTouchEnd}
>
<Video
ref={videoRef}
muted={muted}
controls={false}
resizeMode="cover"
style={styles.container}
source={getVideoSource(story)}
paused={paused}
onLoadStart={onLoadStart}
onLoad={onLoad}
onProgress={onProgress}
onEnd={onEnd}
/>
</TouchableWithoutFeedback>
</>
}
footer={
Expand Down

0 comments on commit 39a6684

Please sign in to comment.