我试图做一个具体的案例iPhone Xs Max中react native?
这是IphoneX来自react-native-iphone-x-helper的一些代码
export function isIphoneX() {
let dimen = Dimensions.get('window');
return (
Platform.OS === 'ios' &&
!Platform.isPad &&
!Platform.isTVOS &&
(dimen.height === 812 || dimen.width === 812)
);
}
Run Code Online (Sandbox Code Playgroud)
什么是尺寸iPhone Xs Max和这样够了刚刚添加的iPhone Xs Max尺寸是多少?
Kev*_*off 14
最后我跟着这个:
export function isIphoneXorAbove() {
const dimen = Dimensions.get('window');
return (
Platform.OS === 'ios' &&
!Platform.isPad &&
!Platform.isTVOS &&
((dimen.height === 812 || dimen.width === 812) || (dimen.height === 896 || dimen.width === 896))
);
}
Run Code Online (Sandbox Code Playgroud)
但所有的功劳归功于这个公关
| 归档时间: |
|
| 查看次数: |
4212 次 |
| 最近记录: |