This repository was archived by the owner on Nov 27, 2025. It is now read-only.
Description
Bug description:
现在的版本不支持h5定位权限获取.
建议在 RNCWebView.ets 中增加 onGeolocationShow 方法
.geolocationAccess(this.descriptorWrapper.rawProps.geolocationEnabled) // 在此下一行增加
.onGeolocationShow((event) => { // 地理位置权限申请通知
AlertDialog.show({
title: '位置权限请求',
message: '是否允许获取位置信息',
primaryButton: {
value: '拒绝',
action: () => {
if (event) {
event.geolocation.invoke(event.origin, false, false); // 不允许此站点地理位置权限请求
}
}
},
secondaryButton: {
value: '允许',
action: () => {
if (event) {
event.geolocation.invoke(event.origin, true, true); // 允许此站点地理位置权限请求
}
}
},
cancel: () => {
if (event) {
event.geolocation.invoke(event.origin, false, false); // 不允许此站点地理位置权限请求
}
}
})
})
To Reproduce:
Expected behavior:
Screenshots/Videos:
Environment:
OS: harmony
OS version: 5.0.0.102
react-native version: 0.72.5
react-native-webview version: 13.10.2-0.2.33
Reactions are currently unavailable
Bug description:
现在的版本不支持h5定位权限获取.
建议在 RNCWebView.ets 中增加 onGeolocationShow 方法
.geolocationAccess(this.descriptorWrapper.rawProps.geolocationEnabled) // 在此下一行增加
.onGeolocationShow((event) => { // 地理位置权限申请通知
AlertDialog.show({
title: '位置权限请求',
message: '是否允许获取位置信息',
primaryButton: {
value: '拒绝',
action: () => {
if (event) {
event.geolocation.invoke(event.origin, false, false); // 不允许此站点地理位置权限请求
}
}
},
secondaryButton: {
value: '允许',
action: () => {
if (event) {
event.geolocation.invoke(event.origin, true, true); // 允许此站点地理位置权限请求
}
}
},
cancel: () => {
if (event) {
event.geolocation.invoke(event.origin, false, false); // 不允许此站点地理位置权限请求
}
}
})
})
To Reproduce:
Expected behavior:
Screenshots/Videos:
Environment: