@@ -46,7 +46,6 @@ import {
4646 MINHEIGHT,
4747} from './Magic';
4848import { bundleManager } from '@kit.AbilityKit';
49-
5049export const TAG = "WebView"
5150
5251export const WEB_VIEW = "RNCWebView"
@@ -366,7 +365,7 @@ export struct RNCWebView {
366365 Web({ src: "", controller: this.controller, renderMode: this.renderMode })
367366 .mixedMode(this.mode)
368367 .onPermissionRequest((event: OnPermissionRequestEvent) => {
369- if (event) {
368+ if (event && (this.getPermissionDialogMessage(event) != "TYPE_SENSOR") ) {
370369 AlertDialog.show({
371370 title: this.resourceToString($r('app.string.on_confirm')) + event.request.getOrigin(),
372371 message: this.getPermissionDialogMessage(event),
@@ -401,6 +400,7 @@ export struct RNCWebView {
401400 .verticalScrollBarAccess(this.descriptorWrapper.rawProps.showsVerticalScrollIndicator)
402401 .overviewModeAccess(this.descriptorWrapper.rawProps.scalesPageToFit)
403402 .textZoomRatio(this.descriptorWrapper.rawProps.textZoom)
403+ .backgroundColor(BaseOperate.getColorMode(this.ctx.uiAbilityContext, this.descriptorWrapper.rawProps.forceDarkOn) === WebDarkMode.On ? Color.White : Color.Transparent)
404404 .darkMode(BaseOperate.getColorMode(this.ctx.uiAbilityContext, this.descriptorWrapper.rawProps.forceDarkOn))
405405 .forceDarkAccess(this.forceDark)
406406 .cacheMode(this.cacheMode)
@@ -492,8 +492,8 @@ export struct RNCWebView {
492492 })
493493 }
494494 this.html = this.source.html
495- this.webviewWidth = this.descriptorWrapper.rawProps .width
496- this.webviewHeight = this.descriptorWrapper.rawProps .height
495+ this.webviewWidth = this.descriptorWrapper.layoutMetrics.frame.size .width
496+ this.webviewHeight = this.descriptorWrapper.layoutMetrics.frame.size .height
497497 this.scrollEnabled = this.descriptorWrapper.rawProps.scrollEnabled;
498498 // 当禁止滚动时,使用父组件滚动
499499 this.nestedScroll = this.scrollEnabled ? NestedScrollMode.SELF_FIRST : NestedScrollMode.PARENT_FIRST;
0 commit comments