@applicaster/zapp-react-native-ui-components
Version:
Applicaster Zapp React Native ui components for the Quick Brick App
39 lines (33 loc) • 1.05 kB
text/typescript
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
import { showDetails } from "./utils";
type Props = { isInline: boolean; isDocked: boolean; isPip: boolean };
const showPlayerDetails = (
isInline: boolean,
isDocked: boolean,
isPip: boolean,
isTablet: boolean
) => {
return showDetails({
isMobile: !isTablet,
isInline,
isDocked,
isPip,
});
};
/**
* Custom hook to determine whether to show player details with a delay.
*
* @param {Object} params - The parameters object.
* @param {boolean} params.isInline - Indicates if the player is inline.
* @param {boolean} params.isDocked - Indicates if the player is docked.
* @param {boolean} params.isPip - Indicates if the player is in PIP mode.
* @returns {boolean} - Returns true if player details should be shown, otherwise false.
*/
export const useDelayedPlayerDetails = ({
isInline,
isDocked,
isPip,
}: Props): boolean => {
const isTablet = useIsTablet();
return showPlayerDetails(isInline, isDocked, isPip, isTablet);
};