diff --git a/example/src/Media.tsx b/example/src/Media.tsx index 0d2fa20..a24743b 100644 --- a/example/src/Media.tsx +++ b/example/src/Media.tsx @@ -3,6 +3,8 @@ import { StyleSheet, View, Text, Image, Pressable } from 'react-native'; import { Navigation, NavigationFunctionComponent } from 'react-native-navigation'; import Video from 'react-native-video'; import { CONTENT_SPACING } from './Constants'; +import { useIsForeground } from './hooks/useIsForeground'; +import { useIsScreenFocused } from './hooks/useIsScreenFocused'; interface MediaProps { path: string, @@ -10,6 +12,10 @@ interface MediaProps { } export const Media: NavigationFunctionComponent = ({ componentId, type, path }) => { + const isForeground = useIsForeground(); + const isScreenFocused = useIsScreenFocused(componentId); + const isVideoPaused = !isForeground || !isScreenFocused; + const onClosePressed = useCallback(() => { Navigation.dismissModal(componentId); }, [componentId]); @@ -18,8 +24,27 @@ export const Media: NavigationFunctionComponent = ({ componentId, ty return ( - {type === "photo" && ()} - {type === "video" && (