UNPKG

@applicaster/zapp-react-native-utils

Version:

Applicaster Zapp React Native utilities package

22 lines (17 loc) 648 B
import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/routeTypes"; import { useNavigation } from "./useNavigation"; import { usePathname } from "./usePathname"; // If current screen is active/focused (visible to the user) export const useIsScreenActive = () => { const pathname = usePathname(); const { currentRoute, videoModalState } = useNavigation(); if (videoModalState.visible) { if (pathname.includes(ROUTE_TYPES.VIDEO_MODAL)) { return true; } if (["FULLSCREEN", "MAXIMIZED", "PIP"].includes(videoModalState.mode)) { return false; } } return pathname === currentRoute; };