Merge pull request #6506 from BlueWallet/nav

FIX: Nav fixes for macOS
This commit is contained in:
GLaDOS 2024-05-03 18:07:55 +00:00 committed by GitHub
commit 7a2740b506
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View File

@ -67,7 +67,7 @@ import PsbtWithHardwareWallet from './screen/send/psbtWithHardwareWallet';
import Success from './screen/send/success';
import UnlockWith from './screen/UnlockWith';
import { isDesktop } from './blue_modules/environment';
import { isDesktop, isHandset } from './blue_modules/environment';
import navigationStyle from './components/navigationStyle';
import { useTheme } from './components/themes';
import loc from './loc';
@ -665,8 +665,7 @@ const NavigationDefaultOptionsForDesktop: NativeStackNavigationOptions = { heade
const StatusBarLightOptions: NativeStackNavigationOptions = { statusBarStyle: 'light' };
const MainRoot = () => {
const isLargeScreen = useIsLargeScreen();
return isLargeScreen ? <DrawerRoot /> : <DetailViewStackScreensStack />;
return isHandset ? <DetailViewStackScreensStack /> : <DrawerRoot />;
};
export default MainRoot;

View File

@ -28,11 +28,11 @@ export const useIsLargeScreen = () => {
// Determine if the window width is at least half of the screen width
const isLargeScreen = useMemo(() => {
const isRunningOnTabletOrDesktop = isTablet() || isDesktop;
const isRunningOnTablet = isTablet();
const halfScreenWidth = windowWidth >= screenWidth / 2;
const condition = isRunningOnTabletOrDesktop && halfScreenWidth;
const condition = (isRunningOnTablet && halfScreenWidth) || isDesktop;
console.debug(
`Window width: ${windowWidth}, Screen width: ${screenWidth}, Is tablet: ${isRunningOnTabletOrDesktop}, Is large screen: ${condition}`,
`Window width: ${windowWidth}, Screen width: ${screenWidth}, Is tablet: ${isTablet}, Is large screen: ${condition}, isDesktkop: ${isDesktop}`,
);
return condition;
}, [windowWidth, screenWidth]);