w***@163.com
w***@163.com
  • 发布:2024-07-02 16:40
  • 更新:2024-07-30 16:28
  • 阅读:59

【报Bug】uni.getSystemInfoSync 小程序开发者工具安卓设备 safeAreaInsets 返回值异常

分类:uni-app

产品分类: uniapp/小程序/阿里

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 22631.3737

HBuilderX类型: 正式

HBuilderX版本号: 4.15

第三方开发者工具版本号: 3.8.21

基础库版本号: 2.9.12

项目创建方式: HBuilderX

示例代码:
const {  
        safeAreaInsets  
    } = uni.getSystemInfoSync()  
// iphone 品牌机型 正常返回  
{  
    "top": 47,  
    "left": 0,  
    "right": 0,  
    "bottom": 34  
}  
// 安卓机型 结果返回异常  
{  
    "top": 0,  
    "left": 0,  
    "right": 0,  
    "bottom": 2340  
}

操作步骤:
const {  
        safeAreaInsets  
    } = uni.getSystemInfoSync()  
// iphone 品牌机型 正常返回  
{  
    "top": 47,  
    "left": 0,  
    "right": 0,  
    "bottom": 34  
}  
// 安卓机型 结果返回异常  
{  
    "top": 0,  
    "left": 0,  
    "right": 0,  
    "bottom": 2340  
}

预期结果:
{  
    "top": 47,  
    "left": 0,  
    "right": 0,  
    "bottom": 34  
}

实际结果:
{  
    "top": 0,  
    "left": 0,  
    "right": 0,  
    "bottom": 2340  
}

bug描述:

1、问题描述:运行支付宝小程序开发者工具,除iphone品牌以外的安卓机型返回异常,详情看下方代码

const {  
        safeAreaInsets  
    } = uni.getSystemInfoSync()  
// iphone 品牌机型 正常返回  
{  
    "top": 47,  
    "left": 0,  
    "right": 0,  
    "bottom": 34  
}  
// 安卓机型 结果返回异常  
{  
    "top": 0,  
    "left": 0,  
    "right": 0,  
    "bottom": 2340  
}
2024-07-02 16:40 负责人:无 分享
已邀请:
DCloud_UNI_OttoJi

DCloud_UNI_OttoJi - 日常回复 uni-app/x 问题,如果艾特我没看到,请主动私信

感谢反馈,你提到安卓获取uni. getSystemInfoSync 里的 safeArea 异常。经过我测试,这个 api 在支付宝小程序相当于调用 my.getSystemInfoSync ,根据对应文档 提示
https://opendocs.alipay.com/mini-game/08v96p

返回值 safeArea 在竖屏正方向下的安全区域。安卓暂不支持。供你参考

要回复问题请先登录注册