Skip to content
This repository was archived by the owner on Mar 10, 2023. It is now read-only.

Commit 3a87d5d

Browse files
authored
Merge pull request #11 from ph1p/bugfix/isiphonex
fix 'isIphoneX' duplicate error
2 parents bedc02d + 395c63d commit 3a87d5d

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

lib/theme.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,23 @@ const colors = {
2525
lightGrey: '#e9e9e9'
2626
};
2727

28-
// https://github.com/ptelad/react-native-iphone-x-helper/blob/master/index.js
29-
function isIphoneX() {
30-
let dimen = Dimensions.get('window');
31-
return (
32-
Platform.OS === 'ios' &&
33-
!Platform.isPad &&
34-
!Platform.isTVOS &&
35-
(dimen.height === 812 || dimen.width === 812)
36-
);
37-
}
38-
3928
const value = (ios = null, android = null) => {
4029
return Platform.select({
4130
ios,
4231
android
4332
});
4433
};
4534

46-
const isIphoneX = isIphoneX();
35+
// https://github.com/ptelad/react-native-iphone-x-helper/blob/master/index.js
36+
const isIphoneX = (function() {
37+
let dimen = Dimensions.get('window');
38+
return (
39+
Platform.OS === 'ios' &&
40+
!Platform.isPad &&
41+
!Platform.isTVOS &&
42+
(dimen.height === 812 || dimen.width === 812)
43+
);
44+
})();
4745
const borderWidth = StyleSheet.hairlineWidth;
4846
const radius = value(5, 2);
4947
const padding = value(10, 16);

0 commit comments

Comments
 (0)