From 2191f297e983698e5ac2d99e2eac121238ba6c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cleehom6666=E2=80=9D?= Date: Sat, 1 Mar 2025 10:25:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=8C=E6=AD=A5sig=E5=88=86=E6=94=AF?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: “leehom6666” --- harmony/rn_webview/src/main/ets/RNCWebView.ets | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/harmony/rn_webview/src/main/ets/RNCWebView.ets b/harmony/rn_webview/src/main/ets/RNCWebView.ets index 27168d609..09a9db766 100644 --- a/harmony/rn_webview/src/main/ets/RNCWebView.ets +++ b/harmony/rn_webview/src/main/ets/RNCWebView.ets @@ -46,7 +46,6 @@ import { MINHEIGHT, } from './Magic'; import { bundleManager } from '@kit.AbilityKit'; - export const TAG = "WebView" export const WEB_VIEW = "RNCWebView" @@ -366,7 +365,7 @@ export struct RNCWebView { Web({ src: "", controller: this.controller, renderMode: this.renderMode }) .mixedMode(this.mode) .onPermissionRequest((event: OnPermissionRequestEvent) => { - if (event) { + if (event && (this.getPermissionDialogMessage(event) != "TYPE_SENSOR")) { AlertDialog.show({ title: this.resourceToString($r('app.string.on_confirm')) + event.request.getOrigin(), message: this.getPermissionDialogMessage(event), @@ -401,6 +400,7 @@ export struct RNCWebView { .verticalScrollBarAccess(this.descriptorWrapper.rawProps.showsVerticalScrollIndicator) .overviewModeAccess(this.descriptorWrapper.rawProps.scalesPageToFit) .textZoomRatio(this.descriptorWrapper.rawProps.textZoom) + .backgroundColor(BaseOperate.getColorMode(this.ctx.uiAbilityContext, this.descriptorWrapper.rawProps.forceDarkOn) === WebDarkMode.On ? Color.White : Color.Transparent) .darkMode(BaseOperate.getColorMode(this.ctx.uiAbilityContext, this.descriptorWrapper.rawProps.forceDarkOn)) .forceDarkAccess(this.forceDark) .cacheMode(this.cacheMode) @@ -492,8 +492,8 @@ export struct RNCWebView { }) } this.html = this.source.html - this.webviewWidth = this.descriptorWrapper.rawProps.width - this.webviewHeight = this.descriptorWrapper.rawProps.height + this.webviewWidth = this.descriptorWrapper.layoutMetrics.frame.size.width + this.webviewHeight = this.descriptorWrapper.layoutMetrics.frame.size.height this.scrollEnabled = this.descriptorWrapper.rawProps.scrollEnabled; // 当禁止滚动时,使用父组件滚动 this.nestedScroll = this.scrollEnabled ? NestedScrollMode.SELF_FIRST : NestedScrollMode.PARENT_FIRST;