fix @Jacksonkr answer and thank you @Made in Moon for providing information regarding the iphone10.3 and iphone10.6 models. You can use this for get device iphone X and above
export default () => {
try {
const exceptions = ['iPhone10,3', 'iPhone10,6'];
const iphoneModel = Device.model;
const m = iphoneModel.match(/iPhone(\d+),?(\d+)?/);
const model = +m[1];
if (model >= 11) {
// is iphone X
return true;
} else if (model === 10) {
// iPhone10,3 = iPhone X
// iPhone10,4 = iPhone 8
// iPhone10,5 = iPhone 8 Plus
// iPhone10,6 = iPhone Xs
return exceptions.includes(iphoneModel);
}
} catch (e) {
console.log(e);
}
return false;
};