react-native 判断是不是IPhone X

react

import {  

Platform,

Dimensions

} from 'react-native';

// iPhoneX

const X_WIDTH = 375;

const X_HEIGHT = 812;

// screen

const SCREEN_WIDTH = Dimensions.get('window').width;

const SCREEN_HEIGHT = Dimensions.get('window').height;

export default function isIphoneX() {

return (

Platform.OS === 'ios' &&

((SCREEN_HEIGHT === X_HEIGHT && SCREEN_WIDTH === X_WIDTH) ||

(SCREEN_HEIGHT === X_WIDTH && SCREEN_WIDTH === X_HEIGHT))

)

}

  

以上是 react-native 判断是不是IPhone X 的全部内容, 来源链接: utcz.com/z/381348.html

回到顶部