Skip to content

Instantly share code, notes, and snippets.

@rgommezz
Created November 15, 2017 21:25
Show Gist options
  • Save rgommezz/a82986b05557f2dd89ebb087d43fb808 to your computer and use it in GitHub Desktop.
Save rgommezz/a82986b05557f2dd89ebb087d43fb808 to your computer and use it in GitHub Desktop.
import { Dimensions } from 'react-native';
// See https://mydevice.io/devices/ for device dimensions
const X_WIDTH = 375;
const X_HEIGHT = 812;
export const isIPhoneX = () => {
const { height: D_HEIGHT, width: D_WIDTH } = Dimensions.get('window');
return Platform.OS === 'ios' &&
((D_HEIGHT === X_HEIGHT && D_WIDTH === X_WIDTH) ||
(D_HEIGHT === X_WIDTH && D_WIDTH === X_HEIGHT));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment