All files / config statusBar.js

60% Statements 6/10
66.67% Branches 8/12
100% Functions 3/3
60% Lines 6/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33          26x 26x                 26x     26x       26x 26x                  
import { Dimensions, Platform, StatusBar } from 'react-native';
 
// Borrowed from https://github.com/ptelad/react-native-iphone-x-helper
 
function isIphoneX() {
  const dimen = Dimensions.get('window');
  return (
    Platform.OS === 'ios' &&
    !Platform.isPad &&
    !Platform.isTVOS &&
    (dimen.height === 812 || dimen.width === 812)
  );
}
 
function ifIphoneX(iphoneXStyle, regularStyle) {
  Iif (isIphoneX()) {
    return iphoneXStyle;
  }
  return regularStyle;
}
 
export function getStatusBarHeight(skipAndroid = false) {
  Eif (Platform.OS === 'ios') {
    return ifIphoneX(44, 20);
  }
 
  if (skipAndroid) {
    return 0;
  }
 
  return StatusBar.currentHeight;
}