react-native-status-bar-height-js
Version:
Get status bar height for React Native App
45 lines (44 loc) • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.STATUS_BAR_HEIGHT = void 0;
var react_native_1 = require("react-native");
var react_native_device_info_1 = require("react-native-device-info");
var IPHONE_WITH_BUTTON_STATUSBAR_HEIGHT = 20;
var IPHONE_DEVICES_MAP = {
'iPhone 14 Pro Max': 54,
'iPhone 14 Pro': 54,
'iPhone 14 Plus': 47,
'iPhone 14': 47,
'iPhone SE 3rd gen': 20,
'iPhone 13 Pro Max': 47,
'iPhone 13 Pro': 47,
'iPhone 13': 47,
'iPhone 13 mini': 50,
'iPhone 12 Pro Max': 47,
'iPhone 12 Pro': 47,
'iPhone 12': 47,
'iPhone 12 mini': 50,
'iPhone SE 2nd gen': 20,
'iPhone 11 Pro Max': 44,
'iPhone 11 Pro': 44,
'iPhone 11': 48,
'iPhone XS Max': 44,
'iPhone XS': 44,
'iPhone XR': 48,
'iPhone X': 44,
'iPhone 8 Plus': 20,
'iPhone 8': 20,
'iPhone 7 Plus': 20,
'iPhone 7': 20,
'iPhone SE 1st gen': 20,
'iPhone 6s Plus': 20,
'iPhone 6s': 20,
'iPhone 6 Plus': 20,
'iPhone 6': 20,
};
var getIPhoneStatusBarHeight = function (deviceName) { return IPHONE_DEVICES_MAP[deviceName] || IPHONE_WITH_BUTTON_STATUSBAR_HEIGHT; };
exports.STATUS_BAR_HEIGHT = react_native_1.Platform.select({
ios: getIPhoneStatusBarHeight((0, react_native_device_info_1.getModel)()),
android: react_native_1.StatusBar.currentHeight,
default: 0,
});