Skip to content

Commit

Permalink
[+] Forgot to add white to the icons!
Browse files Browse the repository at this point in the history
[+] Code Clean up
  • Loading branch information
Elyse Segebart committed Aug 8, 2023
1 parent 70a26eb commit 956175e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
19 changes: 6 additions & 13 deletions src/VideoPlayer.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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<NodeJS.Timeout | null>(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);
Expand Down Expand Up @@ -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);
Expand All @@ -346,10 +339,10 @@ export const VideoPlayer = (props: VideoPlayerProps) => {
} else {
setPaused(false);
}
}, [rewindPressCount, currentTime])
}, [rewindPressCount, currentTime]);

Check failure on line 342 in src/VideoPlayer.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useEffect has missing dependencies: 'duration', 'rewindTime', and 'videoRef'. Either include them or remove the dependency array

Check failure on line 342 in src/VideoPlayer.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useEffect has missing dependencies: 'duration', 'rewindTime', and 'videoRef'. Either include them or remove the dependency array

useEffect(() => {
let skipTime = (duration * 0.0012) * pressCount;
let skipTime = duration * 0.0012 * pressCount;

if (currentTime <= duration && pressCount === 1) {
videoRef?.current?.seek(currentTime + rewindTime);
Expand All @@ -358,7 +351,7 @@ export const VideoPlayer = (props: VideoPlayerProps) => {
} else {
setPaused(false);
}
}, [pressCount, currentTime])
}, [pressCount, currentTime]);

Check failure on line 354 in src/VideoPlayer.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useEffect has missing dependencies: 'duration', 'rewindTime', and 'videoRef'. Either include them or remove the dependency array

Check failure on line 354 in src/VideoPlayer.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useEffect has missing dependencies: 'duration', 'rewindTime', and 'videoRef'. Either include them or remove the dependency array

useEffect(() => {
if (currentTime >= duration) {
Expand Down Expand Up @@ -543,4 +536,4 @@ export const VideoPlayer = (props: VideoPlayerProps) => {
</View>
</PlatformSupport>
);
};
};
4 changes: 3 additions & 1 deletion src/components/PlayPause/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ export const styles = StyleSheet.create({
alignItems: 'center',
},
play: {},
rewind: {},
rewind: {
tintColor: 'white'

Check failure on line 21 in src/components/PlayPause/styles.ts

View workflow job for this annotation

GitHub Actions / build

Insert `,`

Check warning on line 21 in src/components/PlayPause/styles.ts

View workflow job for this annotation

GitHub Actions / build

Missing trailing comma

Check failure on line 21 in src/components/PlayPause/styles.ts

View workflow job for this annotation

GitHub Actions / build

Insert `,`

Check warning on line 21 in src/components/PlayPause/styles.ts

View workflow job for this annotation

GitHub Actions / build

Missing trailing comma
},
});

0 comments on commit 956175e

Please sign in to comment.