Closed eriklumme closed 4 years ago
I am not sure I agree, they help the reader to distinct the 2 different sizes.
They are the same. ((a || b) || (c || d))
and (a || b || c || d)
is true
when there is one true
value in a, b, c, d.
I do not argue that they are not the same, I do argue that they help with understanding
export function isIphoneX() {
const dimen = Dimensions.get('window');
const sizes = [812, 896];
return (
Platform.OS === 'ios'
&& !Platform.isPad
&& !Platform.isTVOS
&& (sizes.includes(dimen.height) || sizes.includes(dimen.width))
);
}
@ptelad This can be another way to solve it?
export function isIphoneX() { const dimen = Dimensions.get('window'); const sizes = [812, 896]; return ( Platform.OS === 'ios' && !Platform.isPad && !Platform.isTVOS && (sizes.includes(dimen.height) || sizes.includes(dimen.width)) ); }
@ptelad This can be another way to solve it?
I like this solution a lot!
Parentheses unnecessary and do not add clarity