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;