amis-rpc-design/node_modules/@react-navigation/elements/lib/module/getDefaultSidebarWidth.js
2023-10-07 19:42:30 +08:00

19 lines
674 B
JavaScript

import { Platform } from 'react-native';
export const getDefaultSidebarWidth = _ref => {
let {
height,
width
} = _ref;
/*
* Default sidebar width is screen width - header height
* with a max width of 280 on mobile and 320 on tablet
* https://material.io/components/navigation-drawer
*/
const smallerAxisSize = Math.min(height, width);
const isLandscape = width > height;
const isTablet = smallerAxisSize >= 600;
const appBarHeight = Platform.OS === 'ios' ? isLandscape ? 32 : 44 : 56;
const maxWidth = isTablet ? 320 : 280;
return Math.min(smallerAxisSize - appBarHeight, maxWidth);
};
//# sourceMappingURL=getDefaultSidebarWidth.js.map