From 956175e3262a142c0f1ca45985067f1664ef45ad Mon Sep 17 00:00:00 2001 From: Elyse Segebart Date: Tue, 8 Aug 2023 15:47:13 -0500 Subject: [PATCH] [+] Forgot to add white to the icons! [+] Code Clean up --- src/VideoPlayer.tsx | 19 ++++++------------- src/components/PlayPause/styles.ts | 4 +++- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/VideoPlayer.tsx b/src/VideoPlayer.tsx index 5e3688d..1874011 100644 --- a/src/VideoPlayer.tsx +++ b/src/VideoPlayer.tsx @@ -1,5 +1,5 @@ import React, {useCallback, useState, useEffect, useRef} from 'react'; -import {View, useTVEventHandler} from 'react-native'; +import {View} from 'react-native'; import Video, { OnLoadData, OnProgressData, @@ -101,17 +101,10 @@ export const VideoPlayer = (props: VideoPlayerProps) => { const [duration, setDuration] = useState(0); // Seeking variables - const [lastEventType, setLastEventType] = useState(''); const [pressCount, setPressCount] = useState(0); const [timeoutId, setTimeoutId] = useState(null); const [rewindPressCount, setRewindPressCount] = useState(0); - const myTVEventHandler = (evt: any) => { - setLastEventType(evt.eventType); - }; - - useTVEventHandler(myTVEventHandler); - const videoRef = props.videoRef || _videoRef; const toggleFullscreen = () => setIsFullscreen((prevState) => !prevState); @@ -337,7 +330,7 @@ export const VideoPlayer = (props: VideoPlayerProps) => { }; useEffect(() => { - let skipTime = (duration * 0.0012) * rewindPressCount; + let skipTime = duration * 0.0012 * rewindPressCount; if (currentTime <= duration && rewindPressCount === 1) { videoRef?.current?.seek(currentTime - rewindTime); @@ -346,10 +339,10 @@ export const VideoPlayer = (props: VideoPlayerProps) => { } else { setPaused(false); } - }, [rewindPressCount, currentTime]) + }, [rewindPressCount, currentTime]); useEffect(() => { - let skipTime = (duration * 0.0012) * pressCount; + let skipTime = duration * 0.0012 * pressCount; if (currentTime <= duration && pressCount === 1) { videoRef?.current?.seek(currentTime + rewindTime); @@ -358,7 +351,7 @@ export const VideoPlayer = (props: VideoPlayerProps) => { } else { setPaused(false); } - }, [pressCount, currentTime]) + }, [pressCount, currentTime]); useEffect(() => { if (currentTime >= duration) { @@ -543,4 +536,4 @@ export const VideoPlayer = (props: VideoPlayerProps) => { ); -}; \ No newline at end of file +}; diff --git a/src/components/PlayPause/styles.ts b/src/components/PlayPause/styles.ts index 07b39a0..72ee987 100644 --- a/src/components/PlayPause/styles.ts +++ b/src/components/PlayPause/styles.ts @@ -17,5 +17,7 @@ export const styles = StyleSheet.create({ alignItems: 'center', }, play: {}, - rewind: {}, + rewind: { + tintColor: 'white' + }, });