From 86d16e5197feb07aa00dc5fc47402f1c73b96975 Mon Sep 17 00:00:00 2001 From: zhengjinshou <> Date: Sat, 18 May 2024 19:55:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0scrollEnabled?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- harmony/rn_webview/src/main/ets/RNCWebView.ets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/harmony/rn_webview/src/main/ets/RNCWebView.ets b/harmony/rn_webview/src/main/ets/RNCWebView.ets index e54b9e199..27f39576c 100644 --- a/harmony/rn_webview/src/main/ets/RNCWebView.ets +++ b/harmony/rn_webview/src/main/ets/RNCWebView.ets @@ -59,6 +59,7 @@ export interface WebViewProps extends ViewBaseProps { shouldStartLoadWithRequestEnabled: boolean webviewDebuggingEnabled: boolean // nestedScrollEnabled: boolean + scrollEnabled: boolean } export class RNCWebViewBridge { @@ -111,6 +112,7 @@ export struct RNCWebView { controllerAttached: boolean = false; // nestedScrollFlag: boolean = false; renderMode: RenderMode = RenderMode.SYNC_RENDER; + scrollEnabled = true; aboutToAppear() { this.descriptor = this.ctx.descriptorRegistry.getDescriptor(this.tag) @@ -148,6 +150,7 @@ export struct RNCWebView { } ) webview.WebviewController.setWebDebuggingAccess(this.descriptor.props.webviewDebuggingEnabled) + this.scrollEnabled = this.descriptor.props.scrollEnabled; this.javaScriptEnable = this.descriptor.props.javaScriptEnabled; this.cacheMode = this.descriptor.props.cacheEnabled ? this.transCacheMode(this.descriptor.props.cacheMode) : CacheMode.Online; @@ -396,6 +399,9 @@ export struct RNCWebView { Logger.debug(TAG, "[RNOH] event progress: " + event.newProgress) } }) + .onPageBegin(() => { + this.controller.setScrollable(this.scrollEnabled) + }) .onPageEnd(() => { Logger.debug(TAG, "[RNOH] onPageEnd") this.runInjectedJavaScript() From a08a91e78bfc863c21e093e32d37d24ebc8b678b Mon Sep 17 00:00:00 2001 From: zhengjinshou <> Date: Sat, 18 May 2024 19:56:18 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DonError=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=9C=AA=E8=A7=A6=E5=8F=91=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- harmony/rn_webview/src/main/ets/RNCWebView.ets | 5 ----- 1 file changed, 5 deletions(-) diff --git a/harmony/rn_webview/src/main/ets/RNCWebView.ets b/harmony/rn_webview/src/main/ets/RNCWebView.ets index 27f39576c..7cbcd9611 100644 --- a/harmony/rn_webview/src/main/ets/RNCWebView.ets +++ b/harmony/rn_webview/src/main/ets/RNCWebView.ets @@ -411,11 +411,6 @@ export struct RNCWebView { if (event) { let errorInfo: string = event.error.getErrorInfo(); let errorCode: number = event.error.getErrorCode(); - if (errorInfo == "ERR_INTERNET_DISCONNECTED" || errorInfo == "ERR_CACHE_MISS" || - !event.request.isMainFrame()) { - Logger.debug(TAG, "[RNOH] ERR_INTERNET_DISCONNECTED:OR ERR_CACHE_MISS") - return - } Logger.debug(TAG, "[RNOH] errorInfo:" + errorInfo) Logger.debug(TAG, "[RNOH] errorCode:" + errorCode) this.onLoadingError(errorCode, errorInfo) From 36e53660107b7163db380742f090538398bd3265 Mon Sep 17 00:00:00 2001 From: zhengjinshou <> Date: Sat, 18 May 2024 19:58:45 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DonNavigationStateC?= =?UTF-8?q?hange=E4=BA=8B=E4=BB=B6=E8=A7=A6=E5=8F=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- harmony/rn_webview/src/main/ets/RNCWebView.ets | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/harmony/rn_webview/src/main/ets/RNCWebView.ets b/harmony/rn_webview/src/main/ets/RNCWebView.ets index 7cbcd9611..1c03a6dc6 100644 --- a/harmony/rn_webview/src/main/ets/RNCWebView.ets +++ b/harmony/rn_webview/src/main/ets/RNCWebView.ets @@ -291,6 +291,20 @@ export struct RNCWebView { }); } + onLoadingStart() { + this.ctx.rnInstance.emitComponentEvent(this.descriptor.tag, WEB_VIEW, { + type: "onLoadingStart", + url: this.controller.getUrl(), + loading: this.progress != 100, + title: this.controller.getTitle(), + canGoBack: this.controller.accessBackward(), + canGoForward: this.controller.accessForward(), + lockIdentifier: 0, + navigationType: "other", + mainDocumentURL: "" + }) + } + onLoadingFinish() { this.ctx.rnInstance.emitComponentEvent(this.descriptor.tag, WEB_VIEW, { type: "onLoadingFinish", @@ -400,6 +414,7 @@ export struct RNCWebView { } }) .onPageBegin(() => { + this.onLoadingStart() this.controller.setScrollable(this.scrollEnabled) }) .onPageEnd(() => {