From 189948bb366da3c643e8533b0236fb559b324a5a Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Tue, 23 Apr 2024 18:53:14 -0400 Subject: [PATCH] Update useIsLargeScreen.ts --- hooks/useIsLargeScreen.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hooks/useIsLargeScreen.ts b/hooks/useIsLargeScreen.ts index b3183a2f1..9feaf9a97 100644 --- a/hooks/useIsLargeScreen.ts +++ b/hooks/useIsLargeScreen.ts @@ -1,6 +1,7 @@ import { useState, useEffect, useMemo } from 'react'; import { Dimensions } from 'react-native'; import { isTablet } from 'react-native-device-info'; +import { isDesktop } from '../blue_modules/environment'; // Custom hook to determine if the screen is large export const useIsLargeScreen = () => { @@ -27,12 +28,11 @@ export const useIsLargeScreen = () => { // Determine if the window width is at least half of the screen width const isLargeScreen = useMemo(() => { - // we dont want to return true on phones. only on tablets for now - const isRunningOnTablet = isTablet(); + const isRunningOnTabletOrDesktop = isTablet() || isDesktop; const halfScreenWidth = windowWidth >= screenWidth / 2; - const condition = isRunningOnTablet && halfScreenWidth; + const condition = isRunningOnTabletOrDesktop && halfScreenWidth; console.log( - `Window width: ${windowWidth}, Screen width: ${screenWidth}, Is tablet or desktop: ${isRunningOnTablet}, Is large screen: ${condition}`, + `Window width: ${windowWidth}, Screen width: ${screenWidth}, Is tablet: ${isRunningOnTabletOrDesktop}, Is large screen: ${condition}`, ); return condition; }, [windowWidth, screenWidth]);