Skip to content

Commit

Permalink
fix(video): fix condition to paused video on touch start and end
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatanSalas committed Nov 2, 2020
1 parent 5100098 commit 803268a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/components/StoryDetailItem/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export const useStoryDetailItem = ({
const [progress, setProgress] = useState(0);

useEffect(() => {
if (isCurrentStory) {
setPaused(false);
}

if (videoRef.current) {
videoRef.current.seek(0);
setProgress(0);
Expand Down
2 changes: 1 addition & 1 deletion src/components/StoryDetailItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const StoryDetailItem: React.FC<StoryDetailItemProps> = ({
resizeMode="cover"
style={styles.container}
source={{ uri: story.video }}
paused={!isCurrentStory && paused}
paused={paused}
onLoadStart={onLoadStart}
onLoad={onLoad}
onProgress={onProgress}
Expand Down

0 comments on commit 803268a

Please sign in to comment.