>我在RN iOS应用程序中遇到问题。当显示是标准的时,一切都很好,但是当它被缩放时,顶部栏完全搞砸了,用户无法单击顶部栏中的任何内容。尝试了SafeAreaView
但没有帮助事业。
问题 有没有办法找出显示器是缩放的还是标准的?
这是查找显示器是缩放还是标准
的解决方案import DeviceInfo from 'react-native-device-info'
const DEVICES = [
'iPhone X',
'iPhone XS',
'iPhone XS Max',
'iPhone XR'
]
const DEVICE_STANDARD_HEIGHTS = {
"iPhone X": 812,
"iPhone XS": 812,
"iPhone XS Max": 896,
"iPhone XR": 896,
}
const { height, width } = Dimensions.get("window");
const device_name = DeviceInfo.getModel();
let is_zoomed = false;
if (DEVICES.includes(device_name)) {
if (DEVICE_STANDARD_HEIGHTS[device_name] > height) { // because when display is zoomed height is less than the standard display
is_zoomed = true;
}
}
根据您的要求对其进行修改:)