Created
March 24, 2018 13:47
-
-
Save alexkuttig/8db561c0d8286ec9c2485b931fb20e34 to your computer and use it in GitHub Desktop.
DimensionsHelper for react-native
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
'use strict'; | |
import { | |
Platform, | |
StatusBar, | |
Dimensions | |
} from 'react-native'; | |
import { isIphoneX } from 'react-native-iphone-x-helper'; | |
export const statusBarHeight = Platform.OS === 'ios' ? (isIphoneX() ? 44 : 20) : StatusBar.currentHeight; | |
export const headerHeight = Platform.OS === 'ios' ? 44 : 56; | |
export const paddingBottomHeight = Platform.OS === 'ios' ? (isIphoneX() ? 34 : 0) : 0; | |
export const SafeAreaWithHeader: {vh: number, vw: number} = { | |
vh: (Dimensions.get('window').height - statusBarHeight - headerHeight - paddingBottomHeight) / 100, | |
vw: Dimensions.get('window').width / 100 | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment