Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified harmony/rn_webview.har
Binary file not shown.
2 changes: 1 addition & 1 deletion harmony/rn_webview/oh-package.json5
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "@react-native-oh-tpl/react-native-webview",
"description": "main cpai architecture",
"main": "index.ets",
"version": "13.10.2-0.0.6",
"version": "13.10.2-0.2.0",
"dependencies": {
"@rnoh/react-native-openharmony": "file:../react_native_openharmony"
}
Expand Down
10 changes: 10 additions & 0 deletions harmony/rn_webview/src/main/ets/RNCWebView.ets
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ export struct RNCWebView {
scrollEnabled = true;
nestedScroll = NestedScrollMode.SELF_FIRST;
headers: Array<webview.WebHeader> = []
injectedJavaScriptBeforeContentLoaded: Array<ScriptItem> = [
{ script: '', scriptRules: ["*"] }
];
allowPageStartInProgress = true;
@State webviewWidth: number = 0
@State webviewHeight: number = 0
Expand Down Expand Up @@ -261,6 +264,12 @@ export struct RNCWebView {
}

this.overScrollMode = this.descriptorWrapper.props.bounces ? OverScrollMode.ALWAYS : OverScrollMode.NEVER;

if (this.descriptorWrapper.props.injectedJavaScriptBeforeContentLoaded) {
this.injectedJavaScriptBeforeContentLoaded = [
{ script: this.descriptorWrapper.props.injectedJavaScriptBeforeContentLoaded, scriptRules: ["*"] }
];
}
}

private registerPostMessage() {
Expand Down Expand Up @@ -645,6 +654,7 @@ export struct RNCWebView {
.overScrollMode(this.overScrollMode)
.backgroundColor(Color.Transparent)
.javaScriptAccess(this.javaScriptEnable)
.javaScriptOnDocumentStart(this.injectedJavaScriptBeforeContentLoaded)
.horizontalScrollBarAccess(this.descriptorWrapper.props.showsHorizontalScrollIndicator)
.verticalScrollBarAccess(this.descriptorWrapper.props.showsVerticalScrollIndicator)
.overviewModeAccess(this.descriptorWrapper.props.scalesPageToFit)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"Thibault Malbranche <malbranche.thibault@gmail.com>"
],
"license": "MIT",
"version": "13.10.2-0.0.6",
"version": "13.10.2-0.2.0",
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
"scripts": {
"android": "react-native run-android",
Expand Down