Created
September 21, 2018 16:29
-
-
Save andres-torres-marroquin/dc043d88f3683726662b7c6bcbd0d171 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
{ | |
Platform | |
} = require 'react-native' | |
getBottomTabsHeight = -> | |
if Platform.OS is 'android' | |
return 56 | |
if Platform.OS is 'ios' | |
return if isIphoneX() then 84 else 50 | |
module.exports = getBottomTabsHeight |
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
# Based on https://github.com/ptelad/react-native-iphone-x-helper/blob/master/index.js | |
{ | |
Dimensions | |
Platform | |
} = require 'react-native' | |
isIphoneX = -> | |
if Platform.OS isnt 'ios' | |
return no | |
if Platform.isPad or Platform.isTVOS | |
return no | |
dimensions = Dimensions.get 'window' | |
if (dimensions.height is 812 or dimensions.width is 812) | |
# iPhone X, XS | |
return yes | |
if (dimensions.height is 896 or dimensions.width is 896) | |
# iPhone XR, XS Max | |
return yes | |
return no | |
module.exports = isIphoneX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment