@react-navigation/elements
Version:
UI Components for React Navigation
34 lines (32 loc) • 1 kB
JavaScript
import { PixelRatio, Platform } from 'react-native';
export function getDefaultHeaderHeight(layout, modalPresentation, topInset) {
let headerHeight;
// On models with Dynamic Island the status bar height is smaller than the safe area top inset.
const hasDynamicIsland = Platform.OS === 'ios' && topInset > 50;
const statusBarHeight = hasDynamicIsland ? topInset - (5 + 1 / PixelRatio.get()) : topInset;
const isLandscape = layout.width > layout.height;
if (Platform.OS === 'ios') {
if (Platform.isPad || Platform.isTV) {
if (modalPresentation) {
headerHeight = 56;
} else {
headerHeight = 50;
}
} else {
if (isLandscape) {
headerHeight = 32;
} else {
if (modalPresentation) {
headerHeight = 56;
} else {
headerHeight = 44;
}
}
}
} else {
headerHeight = 64;
}
return headerHeight + statusBarHeight;
}
//# sourceMappingURL=getDefaultHeaderHeight.js.map
;