From 803268ac2d7a0f46a2aa4bf1e120e4095e7e0c54 Mon Sep 17 00:00:00 2001 From: JonatanSalas Date: Mon, 2 Nov 2020 19:23:44 -0300 Subject: [PATCH] fix(video): fix condition to paused video on touch start and end --- src/components/StoryDetailItem/hook.ts | 4 ++++ src/components/StoryDetailItem/index.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/StoryDetailItem/hook.ts b/src/components/StoryDetailItem/hook.ts index 14d121f..291da83 100644 --- a/src/components/StoryDetailItem/hook.ts +++ b/src/components/StoryDetailItem/hook.ts @@ -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); diff --git a/src/components/StoryDetailItem/index.tsx b/src/components/StoryDetailItem/index.tsx index e4d780c..5d58a2a 100644 --- a/src/components/StoryDetailItem/index.tsx +++ b/src/components/StoryDetailItem/index.tsx @@ -73,7 +73,7 @@ export const StoryDetailItem: React.FC = ({ resizeMode="cover" style={styles.container} source={{ uri: story.video }} - paused={!isCurrentStory && paused} + paused={paused} onLoadStart={onLoadStart} onLoad={onLoad} onProgress={onProgress}