Last active
January 26, 2019 00:40
-
-
Save steniowagner/86bb59e409fcb83782a9fbc5f7d2053d to your computer and use it in GitHub Desktop.
This file contains 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 | |
import { Dimensions, Platform } from 'react-native'; | |
const screenWidth = Dimensions.get('window').width; | |
const screenHeight = Dimensions.get('window').height; | |
const IPHONEX_WIDTH = 375; | |
const IPHONEX_HEIGHT = 812; | |
const isIphoneX = (): boolean => { | |
const isIphoneXInPortraitMode = screenHeight === IPHONEX_HEIGHT && screenWidth === IPHONEX_WIDTH; | |
const isIphoneXInLandscapeMode = screenHeight === IPHONEX_WIDTH && screenWidth === IPHONEX_HEIGHT; | |
return ( | |
Platform.OS === 'ios' | |
&& (isIphoneXInPortraitMode || isIphoneXInLandscapeMode) | |
); | |
}; | |
export default isIphoneX; | |
/** | |
* USAGE | |
* tabBarOptions: { | |
style: { | |
paddingBottom: isIphoneX() ? 30 : 0, | |
} | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment