mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 15:20:55 +01:00
Merge pull request #6453 from BlueWallet/layoutfix
Update useIsLargeScreen.ts
This commit is contained in:
commit
0bf4c3fc23
1 changed files with 4 additions and 4 deletions
|
@ -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]);
|
||||
|
|
Loading…
Add table
Reference in a new issue