UNPKG

react-native-unit-components

Version:

Unit React Native components

21 lines (14 loc) 1.07 kB
import { Dimensions, Platform, StatusBar } from 'react-native'; export const BOTTOM_SHEET_OVER_FULLSCREEN_PERCENTAGE_SIZE = 0.9; export const androidStatusBarHeight = StatusBar.currentHeight || 0; // For iOS - we are currently using hard coded height export const iosStatusBarHeight = Dimensions.get('window').height * 0.05; export const statusBarHeight = Platform.OS === 'android' ? androidStatusBarHeight : iosStatusBarHeight; // Android 10 and above - need to add status bar height to the window height to get the full screen height because Dimensions.get('window').height returns the height without the status bar // reference: https://github.com/facebook/react-native/issues/23693#issuecomment-1403560728 export const isAndroid10AndAbove = Platform.OS === 'android' && Platform.Version >= 29; export const fullScreenHeight = isAndroid10AndAbove ? Dimensions.get('window').height + statusBarHeight : Dimensions.get('window').height; export const overFullScreenHeight = Dimensions.get('window').height * BOTTOM_SHEET_OVER_FULLSCREEN_PERCENTAGE_SIZE;