Skip to content
This repository was archived by the owner on Nov 27, 2025. It is now read-only.

Commit 938414f

Browse files
添加web渲染为RenderMode.SYNC_RENDER
Signed-off-by: leehom <[email protected]>
1 parent 87ae41d commit 938414f

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

harmony/rn_webview.har

-10 Bytes
Binary file not shown.

harmony/rn_webview/oh-package.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "@react-native-oh-tpl/react-native-webview",
77
"description": "main cpai architecture",
88
"main": "index.ets",
9-
"version": "13.6.3-0.1.5",
9+
"version": "13.6.3-0.1.6",
1010
"dependencies": {
1111
"rnoh": "file:../rnoh"
1212
}

harmony/rn_webview/src/main/ets/WebView.ets

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export struct WebView {
109109
hasRegisterJavaScriptProxy: boolean = false;
110110
controllerAttached: boolean = false;
111111
nestedScrollFlag: boolean = false;
112-
//renderMode: RenderMode = RenderMode.ASYNC_RENDER;
112+
renderMode: RenderMode = RenderMode.SYNC_RENDER;
113113

114114
aboutToAppear() {
115115
this.descriptor = this.ctx.descriptorRegistry.getDescriptor<WebViewViewDescriptor>(this.tag)
@@ -152,7 +152,6 @@ export struct WebView {
152152
this.html = this.source.html
153153
this.url = this.source.uri;
154154
this.nestedScrollFlag = this.descriptor.props.nestedScrollEnabled;
155-
//this.renderMode = this.nestedScrollFlag ? RenderMode.SYNC_RENDER : RenderMode.ASYNC_RENDER;
156155
this.registerCommandCallback()
157156
}
158157

@@ -362,11 +361,10 @@ export struct WebView {
362361

363362
build() {
364363
//RNViewBase({ ctx: this.ctx, tag: this.tag }) {
365-
//Web({ src: this.source.uri, controller: this.controller, renderMode: this.renderMode })
366364
Stack() {
367-
Web({ src: this.source.uri, controller: this.controller })
368-
.width('100%')
369-
.height('100%')
365+
Web({ src: this.source.uri, controller: this.controller,renderMode: this.renderMode })
366+
.width(this.descriptor.layoutMetrics.frame.size.width)
367+
.height(this.descriptor.layoutMetrics.frame.size.height)
370368
.constraintSize({ minHeight: 1 })
371369
.backgroundColor(Color.Transparent)
372370
.javaScriptAccess(this.javaScriptEnable)
@@ -384,6 +382,9 @@ export struct WebView {
384382
scrollBackward: NestedScrollMode.SELF_ONLY
385383
} : { scrollForward: NestedScrollMode.PARENT_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST })
386384
.overScrollMode(OverScrollMode.NEVER)
385+
.onSizeChange((event)=>{
386+
Logger.info(TAG, "[RNOH] event width: " + event.width + "[RNOH] event height: " + event.height)
387+
})
387388
.onProgressChange((event) => {
388389
if (event) {
389390
this.progress = event.newProgress

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"Thibault Malbranche <[email protected]>"
1111
],
1212
"license": "MIT",
13-
"version": "13.6.3-0.1.5",
13+
"version": "13.6.3-0.1.6",
1414
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
1515
"scripts": {
1616
"lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx",

0 commit comments

Comments
 (0)