ptelad / react-native-iphone-x-helper

A library to help you design your react-native app for notched iPhones
MIT License
942 stars 138 forks source link

Remove unnecessary parantheses #11

Closed eriklumme closed 4 years ago

eriklumme commented 6 years ago

Parentheses unnecessary and do not add clarity

ptelad commented 6 years ago

I am not sure I agree, they help the reader to distinct the 2 different sizes.

gxsshallot commented 6 years ago

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.

ptelad commented 6 years ago

I do not argue that they are not the same, I do argue that they help with understanding

mtzluisalfredo commented 5 years ago
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?

ptelad commented 5 years ago
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!