From 00c5efc5d76f7888b57c4323740d793d2cddcf8f Mon Sep 17 00:00:00 2001 From: smelaa Date: Fri, 23 Feb 2024 09:54:12 +0100 Subject: [PATCH 01/20] PlaybackContext migrated to ts --- ...PlaybackContext.js => PlaybackContext.tsx} | 56 ++++++++++--------- src/components/VideoPlayerContexts/types.ts | 17 ++++++ 2 files changed, 47 insertions(+), 26 deletions(-) rename src/components/VideoPlayerContexts/{PlaybackContext.js => PlaybackContext.tsx} (63%) create mode 100644 src/components/VideoPlayerContexts/types.ts diff --git a/src/components/VideoPlayerContexts/PlaybackContext.js b/src/components/VideoPlayerContexts/PlaybackContext.tsx similarity index 63% rename from src/components/VideoPlayerContexts/PlaybackContext.js rename to src/components/VideoPlayerContexts/PlaybackContext.tsx index b77068f3aea2..d931296831c7 100644 --- a/src/components/VideoPlayerContexts/PlaybackContext.js +++ b/src/components/VideoPlayerContexts/PlaybackContext.tsx @@ -1,52 +1,53 @@ +import type {Video} from 'expo-av'; import PropTypes from 'prop-types'; +import type {ReactNode} from 'react'; import React, {useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react'; +import type {View} from 'react-native'; import useCurrentReportID from '@hooks/useCurrentReportID'; +import type PlaybackContext from './types'; -const PlaybackContext = React.createContext(null); +const Context = React.createContext(null); -function PlaybackContextProvider({children}) { - const [currentlyPlayingURL, setCurrentlyPlayingURL] = useState(null); - const [sharedElement, setSharedElement] = useState(null); - const [originalParent, setOriginalParent] = useState(null); - const currentVideoPlayerRef = useRef(null); - const {currentReportID} = useCurrentReportID(); +function PlaybackContextProvider({children}: {children: ReactNode}) { + const [currentlyPlayingURL, setCurrentlyPlayingURL] = useState(null); + const [sharedElement, setSharedElement] = useState(null); + const [originalParent, setOriginalParent] = useState(null); + const currentVideoPlayerRef = useRef