amis-rpc-design/node_modules/@react-navigation/elements/lib/module/getDefaultSidebarWidth.js

19 lines
674 B
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
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