@react-native-ohos/react-native-webview 13.10.5-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/harmony/rn_webview/BuildProfile.ets +41 -0
- package/harmony/rn_webview/LICENSE +21 -0
- package/harmony/rn_webview/NOTICE +33 -0
- package/harmony/rn_webview/OAT.xml +45 -0
- package/harmony/rn_webview/README.OpenSource +11 -0
- package/harmony/rn_webview/build-profile.json5 +28 -0
- package/harmony/rn_webview/consumer-rules.txt +0 -0
- package/harmony/rn_webview/hvigorfile.ts +1 -0
- package/harmony/rn_webview/index.ets +34 -0
- package/harmony/rn_webview/obfuscation-rules.txt +18 -0
- package/harmony/rn_webview/oh-package.json5 +13 -0
- package/harmony/rn_webview/src/main/cpp/CMakeLists.txt +9 -0
- package/harmony/rn_webview/src/main/cpp/WebViewPackage.h +37 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/BaseReactNativeWebviewPackage.h +95 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/components/RNCWebViewJSIBinder.h +126 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.cpp +20 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.h +16 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.cpp +19 -0
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.h +16 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ComponentDescriptors.h +22 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.cpp +240 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.h +285 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.cpp +151 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.h +337 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.cpp +19 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.h +34 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.cpp +16 -0
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.h +20 -0
- package/harmony/rn_webview/src/main/ets/CutomReference.ts +50 -0
- package/harmony/rn_webview/src/main/ets/Logger.ts +64 -0
- package/harmony/rn_webview/src/main/ets/Magic.ets +205 -0
- package/harmony/rn_webview/src/main/ets/RNCWebView.ets +607 -0
- package/harmony/rn_webview/src/main/ets/RNCWebViewPackage.ets +66 -0
- package/harmony/rn_webview/src/main/ets/ShouldRequestUrl.ts +68 -0
- package/harmony/rn_webview/src/main/ets/WebViewBaseOperate.ets +463 -0
- package/harmony/rn_webview/src/main/ets/WebViewTurboModule.ets +78 -0
- package/harmony/rn_webview/src/main/ets/generated/components/RNCWebView.ts +509 -0
- package/harmony/rn_webview/src/main/ets/generated/components/ts.ts +5 -0
- package/harmony/rn_webview/src/main/ets/generated/index.ets +5 -0
- package/harmony/rn_webview/src/main/ets/generated/ts.ts +6 -0
- package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebView.ts +18 -0
- package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebViewModule.ts +16 -0
- package/harmony/rn_webview/src/main/ets/generated/turboModules/ts.ts +6 -0
- package/harmony/rn_webview/src/main/module.json5 +11 -0
- package/harmony/rn_webview/src/main/resources/base/element/string.json +40 -0
- package/harmony/rn_webview/src/main/resources/en_US/element/string.json +40 -0
- package/harmony/rn_webview/src/main/resources/zh_CN/element/string.json +40 -0
- package/harmony/rn_webview/src/test/List.test.ets +5 -0
- package/harmony/rn_webview/src/test/LocalUnit.test.ets +33 -0
- package/harmony/rn_webview/ts.ets +29 -0
- package/harmony/rn_webview.har +0 -0
- package/package.json +107 -0
- package/src/NativeRNCWebView.ts +16 -0
- package/src/NativeRNCWebViewModule.ts +17 -0
- package/src/RNCWebViewNativeComponent.ts +286 -0
- package/src/WebView.harmony.tsx +330 -0
- package/src/WebView.tsx +4 -0
- package/src/codegenUtils.ts +9 -0
- package/src/index.ts +4 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "page_show",
|
|
5
|
+
"value": "page from npm package"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"name": "deny",
|
|
9
|
+
"value": "不允许"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "on_confirm",
|
|
13
|
+
"value": "允许"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "use_your_camera",
|
|
17
|
+
"value": "使用你的摄像头?"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "use_your_microphone",
|
|
21
|
+
"value": "使用你的麦克风?"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "use_your_camera_and_microphone",
|
|
25
|
+
"value": "使用你的摄像头和麦克风?"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "midi_sysex_resources",
|
|
29
|
+
"value": "访问 MIDI SYSEX 资源?"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "determined",
|
|
33
|
+
"value": "确认"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "cancel",
|
|
37
|
+
"value": "取消"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
|
2
|
+
|
|
3
|
+
export default function localUnitTest() {
|
|
4
|
+
describe('localUnitTest',() => {
|
|
5
|
+
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
|
6
|
+
beforeAll(() => {
|
|
7
|
+
// Presets an action, which is performed only once before all test cases of the test suite start.
|
|
8
|
+
// This API supports only one parameter: preset action function.
|
|
9
|
+
});
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
// Presets an action, which is performed before each unit test case starts.
|
|
12
|
+
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
13
|
+
// This API supports only one parameter: preset action function.
|
|
14
|
+
});
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
// Presets a clear action, which is performed after each unit test case ends.
|
|
17
|
+
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
18
|
+
// This API supports only one parameter: clear action function.
|
|
19
|
+
});
|
|
20
|
+
afterAll(() => {
|
|
21
|
+
// Presets a clear action, which is performed after all test cases of the test suite end.
|
|
22
|
+
// This API supports only one parameter: clear action function.
|
|
23
|
+
});
|
|
24
|
+
it('assertContain', 0, () => {
|
|
25
|
+
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
|
|
26
|
+
let a = 'abc';
|
|
27
|
+
let b = 'b';
|
|
28
|
+
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
|
|
29
|
+
expect(a).assertContain(b);
|
|
30
|
+
expect(a).assertEqual(a);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import {RNCWebViewPackage as WebViewPackage} from './src/main/ets/RNCWebViewPackage'
|
|
26
|
+
|
|
27
|
+
export {WebViewPackage};
|
|
28
|
+
|
|
29
|
+
export * from './src/main/ets/RNCWebViewPackage'
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/react-native-webview",
|
|
3
|
+
"description": "React Native WebView component for harmony",
|
|
4
|
+
"react-native": "src/index",
|
|
5
|
+
"source": "src/index",
|
|
6
|
+
"typings": "index.d.ts",
|
|
7
|
+
"author": "Jamon Holmgren <jamon@infinite.red>",
|
|
8
|
+
"contributors": [
|
|
9
|
+
"Thibault Malbranche <malbranche.thibault@gmail.com>"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"version": "13.10.5-rc.1",
|
|
13
|
+
"homepage": "https://github.com/react-native-oh-library/react-native-webview#readme",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"macos": "react-native run-macos --scheme WebviewExample --project-path example/macos",
|
|
16
|
+
"start": "react-native start",
|
|
17
|
+
"windows": "install-windows-test-app --project-directory example/windows && react-native run-windows --root example --arch x64",
|
|
18
|
+
"ci": "CI=true && yarn lint",
|
|
19
|
+
"ci:publish": "yarn semantic-release",
|
|
20
|
+
"lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx,.js,.jsx",
|
|
21
|
+
"build": "babel --extensions \".ts,.tsx\" --out-dir lib src",
|
|
22
|
+
"prepare:types": "tsc --noEmit false --emitDeclarationOnly --declaration --rootDir src --outDir lib",
|
|
23
|
+
"prepare": "yarn prepare:types && yarn build",
|
|
24
|
+
"appium": "appium",
|
|
25
|
+
"test:windows": "yarn jest --setupFiles=./jest-setups/jest.setup.js",
|
|
26
|
+
"add:macos": "yarn add react-native-macos@0.73.17",
|
|
27
|
+
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-webview --cpp-output-path ./harmony/rn_webview/src/main/cpp/generated --ets-output-path ./harmony/rn_webview/src/main/ets/generated --turbo-modules-spec-paths ./src --arkts-components-spec-paths ./src"
|
|
28
|
+
},
|
|
29
|
+
"rn-docs": {
|
|
30
|
+
"title": "Webview",
|
|
31
|
+
"type": "Component"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"react": "*",
|
|
35
|
+
"react-native": "*"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"escape-string-regexp": "2.0.0",
|
|
39
|
+
"invariant": "2.2.4",
|
|
40
|
+
"react-native-webview": "13.10.2",
|
|
41
|
+
"yarn": "^1.22.22"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@babel/cli": "^7.20.0",
|
|
45
|
+
"@babel/core": "^7.20.0",
|
|
46
|
+
"@babel/runtime": "^7.20.0",
|
|
47
|
+
"@callstack/react-native-visionos": "0.73.8",
|
|
48
|
+
"@react-native/babel-preset": "0.73.21",
|
|
49
|
+
"@react-native/eslint-config": "0.73.2",
|
|
50
|
+
"@react-native/metro-config": "0.73.5",
|
|
51
|
+
"@react-native/typescript-config": "0.73.1",
|
|
52
|
+
"@rnoh/react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27",
|
|
53
|
+
"@rnx-kit/metro-config": "1.3.15",
|
|
54
|
+
"@semantic-release/git": "7.0.16",
|
|
55
|
+
"@types/invariant": "^2.2.30",
|
|
56
|
+
"@types/jest": "^29.5.12",
|
|
57
|
+
"@types/minimatch": "^6.0.0",
|
|
58
|
+
"@types/react": "18.2.61",
|
|
59
|
+
"@types/selenium-webdriver": "4.0.9",
|
|
60
|
+
"appium": "1.17.0",
|
|
61
|
+
"eslint": "8.57.0",
|
|
62
|
+
"jest": "^29.6.3",
|
|
63
|
+
"metro-react-native-babel-preset": "0.73.7",
|
|
64
|
+
"minimatch": "^10.0.3",
|
|
65
|
+
"prettier": "2.8.8",
|
|
66
|
+
"react": "18.2.0",
|
|
67
|
+
"react-native": "0.73.5",
|
|
68
|
+
"react-native-macos": "0.73.17",
|
|
69
|
+
"react-native-test-app": "3.7.2",
|
|
70
|
+
"react-native-windows": "0.73.8",
|
|
71
|
+
"selenium-appium": "1.0.2",
|
|
72
|
+
"selenium-webdriver": "4.0.0-alpha.7",
|
|
73
|
+
"semantic-release": "15.13.24",
|
|
74
|
+
"typescript": "5.1.3",
|
|
75
|
+
"winappdriver": "^0.0.7"
|
|
76
|
+
},
|
|
77
|
+
"repository": {
|
|
78
|
+
"type": "git",
|
|
79
|
+
"url": "git://github.com/react-native-oh-library/react-native-webview.git"
|
|
80
|
+
},
|
|
81
|
+
"files": [
|
|
82
|
+
"src",
|
|
83
|
+
"harmony",
|
|
84
|
+
"react-native-webview.podspec",
|
|
85
|
+
"!**/__tests__",
|
|
86
|
+
"!**/__fixtures__",
|
|
87
|
+
"!**/__mocks__"
|
|
88
|
+
],
|
|
89
|
+
"keywords": [
|
|
90
|
+
"react-native",
|
|
91
|
+
"harmony"
|
|
92
|
+
],
|
|
93
|
+
"publishConfig": {
|
|
94
|
+
"registry": "https://registry.npmjs.org/",
|
|
95
|
+
"access": "public"
|
|
96
|
+
},
|
|
97
|
+
"harmony": {
|
|
98
|
+
"alias": "react-native-webview",
|
|
99
|
+
"autolinking": {
|
|
100
|
+
"etsPackageClassName": "WebViewPackage",
|
|
101
|
+
"cppPackageClassName": "WebViewPackage",
|
|
102
|
+
"cmakeLibraryTargetName": "rnoh_webview",
|
|
103
|
+
"ohPackageName": "@react-native-ohos/react-native-webview"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"packageManager": "yarn@1.22.19"
|
|
107
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
import { Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
readonly getConstants: () => {};
|
|
7
|
+
|
|
8
|
+
// your module methods go here, for example:
|
|
9
|
+
isFileUploadSupported(): Promise<boolean>;
|
|
10
|
+
shouldStartLoadWithLockIdentifier(
|
|
11
|
+
shouldStart: boolean,
|
|
12
|
+
lockIdentifier: Double
|
|
13
|
+
): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNCWebView');
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import type { TurboModule } from 'react-native';
|
|
6
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
7
|
+
import { Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
8
|
+
|
|
9
|
+
export interface Spec extends TurboModule {
|
|
10
|
+
isFileUploadSupported(): Promise<boolean>;
|
|
11
|
+
shouldStartLoadWithLockIdentifier(
|
|
12
|
+
shouldStart: boolean,
|
|
13
|
+
lockIdentifier: Double
|
|
14
|
+
): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNCWebViewModule');
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
3
|
+
import {DirectEventHandler,Double, Int32, WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
5
|
+
import type { UnsafeMixed } from './codegenUtils';
|
|
6
|
+
|
|
7
|
+
export type WebViewNativeEvent = Readonly<{
|
|
8
|
+
url: string;
|
|
9
|
+
loading: boolean;
|
|
10
|
+
title: string;
|
|
11
|
+
canGoBack: boolean;
|
|
12
|
+
canGoForward: boolean;
|
|
13
|
+
lockIdentifier: Double;
|
|
14
|
+
}>
|
|
15
|
+
export type WebViewCustomMenuSelectionEvent = Readonly<{
|
|
16
|
+
label: string;
|
|
17
|
+
key: string;
|
|
18
|
+
selectedText: string;
|
|
19
|
+
}>
|
|
20
|
+
export type WebViewMessageEvent = Readonly<{
|
|
21
|
+
url: string;
|
|
22
|
+
loading: boolean;
|
|
23
|
+
title: string;
|
|
24
|
+
canGoBack: boolean;
|
|
25
|
+
canGoForward: boolean;
|
|
26
|
+
lockIdentifier: Double;
|
|
27
|
+
data: string;
|
|
28
|
+
}>
|
|
29
|
+
export type WebViewOpenWindowEvent = Readonly<{
|
|
30
|
+
targetUrl: string;
|
|
31
|
+
}>
|
|
32
|
+
export type WebViewHttpErrorEvent = Readonly<{
|
|
33
|
+
url: string;
|
|
34
|
+
loading: boolean;
|
|
35
|
+
title: string;
|
|
36
|
+
canGoBack: boolean;
|
|
37
|
+
canGoForward: boolean;
|
|
38
|
+
lockIdentifier: Double;
|
|
39
|
+
description: string;
|
|
40
|
+
statusCode: Int32;
|
|
41
|
+
}>
|
|
42
|
+
|
|
43
|
+
export type WebViewErrorEvent = Readonly<{
|
|
44
|
+
url: string;
|
|
45
|
+
loading: boolean;
|
|
46
|
+
title: string;
|
|
47
|
+
canGoBack: boolean;
|
|
48
|
+
canGoForward: boolean;
|
|
49
|
+
lockIdentifier: Double;
|
|
50
|
+
domain?: string;
|
|
51
|
+
code: Int32;
|
|
52
|
+
description: string;
|
|
53
|
+
}>
|
|
54
|
+
|
|
55
|
+
export type WebViewNativeProgressEvent = Readonly< {
|
|
56
|
+
url: string;
|
|
57
|
+
loading: boolean;
|
|
58
|
+
title: string;
|
|
59
|
+
canGoBack: boolean;
|
|
60
|
+
canGoForward: boolean;
|
|
61
|
+
lockIdentifier: Double;
|
|
62
|
+
progress: Double;
|
|
63
|
+
}>
|
|
64
|
+
|
|
65
|
+
export type WebViewNavigationEvent = Readonly< {
|
|
66
|
+
url: string;
|
|
67
|
+
loading: boolean;
|
|
68
|
+
title: string;
|
|
69
|
+
canGoBack: boolean;
|
|
70
|
+
canGoForward: boolean;
|
|
71
|
+
lockIdentifier: Double;
|
|
72
|
+
navigationType:
|
|
73
|
+
| 'click'
|
|
74
|
+
| 'formsubmit'
|
|
75
|
+
| 'backforward'
|
|
76
|
+
| 'reload'
|
|
77
|
+
| 'formresubmit'
|
|
78
|
+
| 'other';
|
|
79
|
+
mainDocumentURL?: string;
|
|
80
|
+
}>
|
|
81
|
+
|
|
82
|
+
export type ShouldStartLoadRequestEvent = Readonly<{
|
|
83
|
+
url: string;
|
|
84
|
+
loading: boolean;
|
|
85
|
+
title: string;
|
|
86
|
+
canGoBack: boolean;
|
|
87
|
+
canGoForward: boolean;
|
|
88
|
+
lockIdentifier: Double;
|
|
89
|
+
navigationType:
|
|
90
|
+
| 'click'
|
|
91
|
+
| 'formsubmit'
|
|
92
|
+
| 'backforward'
|
|
93
|
+
| 'reload'
|
|
94
|
+
| 'formresubmit'
|
|
95
|
+
| 'other';
|
|
96
|
+
mainDocumentURL?: string;
|
|
97
|
+
isTopFrame: boolean;
|
|
98
|
+
}>
|
|
99
|
+
|
|
100
|
+
type ScrollEvent = Readonly<{
|
|
101
|
+
contentInset: {
|
|
102
|
+
bottom: Double,
|
|
103
|
+
left: Double,
|
|
104
|
+
right: Double,
|
|
105
|
+
top: Double,
|
|
106
|
+
},
|
|
107
|
+
contentOffset: {
|
|
108
|
+
y: Double,
|
|
109
|
+
x: Double,
|
|
110
|
+
},
|
|
111
|
+
contentSize: {
|
|
112
|
+
height: Double,
|
|
113
|
+
width: Double,
|
|
114
|
+
},
|
|
115
|
+
layoutMeasurement: {
|
|
116
|
+
height: Double,
|
|
117
|
+
width: Double,
|
|
118
|
+
},
|
|
119
|
+
targetContentOffset?: {
|
|
120
|
+
y: Double,
|
|
121
|
+
x: Double,
|
|
122
|
+
},
|
|
123
|
+
velocity?: {
|
|
124
|
+
y: Double,
|
|
125
|
+
x: Double,
|
|
126
|
+
},
|
|
127
|
+
zoomScale?: Double,
|
|
128
|
+
responderIgnoreScroll?: boolean,
|
|
129
|
+
}>
|
|
130
|
+
|
|
131
|
+
type WebViewRenderProcessGoneEvent = Readonly<{
|
|
132
|
+
didCrash: boolean;
|
|
133
|
+
}>
|
|
134
|
+
|
|
135
|
+
type WebViewDownloadEvent = Readonly<{
|
|
136
|
+
downloadUrl: string;
|
|
137
|
+
}>
|
|
138
|
+
|
|
139
|
+
// type MenuItem = Readonly<{label: string, key: string}>;
|
|
140
|
+
|
|
141
|
+
export interface NativeProps extends ViewProps {
|
|
142
|
+
// Android only
|
|
143
|
+
allowFileAccess?: boolean;
|
|
144
|
+
allowsProtectedMedia?: boolean;
|
|
145
|
+
allowsFullscreenVideo?: boolean;
|
|
146
|
+
androidLayerType?: WithDefault<'none' | 'software' | 'hardware', 'none'>;
|
|
147
|
+
cacheMode?: WithDefault<'LOAD_DEFAULT' | 'LOAD_CACHE_ELSE_NETWORK' | 'LOAD_NO_CACHE' | 'LOAD_CACHE_ONLY', 'LOAD_DEFAULT'>;
|
|
148
|
+
domStorageEnabled?: boolean;
|
|
149
|
+
downloadingMessage?: string;
|
|
150
|
+
forceDarkOn?: boolean;
|
|
151
|
+
geolocationEnabled?: WithDefault<boolean, false>;
|
|
152
|
+
lackPermissionToDownloadMessage?: string;
|
|
153
|
+
messagingModuleName: string;
|
|
154
|
+
minimumFontSize?: Int32;
|
|
155
|
+
mixedContentMode?: WithDefault<'never' | 'always' | 'compatibility', 'never'>;
|
|
156
|
+
nestedScrollEnabled?: boolean;
|
|
157
|
+
onContentSizeChange?: DirectEventHandler<WebViewNativeEvent>;
|
|
158
|
+
onRenderProcessGone?: DirectEventHandler<WebViewRenderProcessGoneEvent>;
|
|
159
|
+
overScrollMode?: string;
|
|
160
|
+
saveFormDataDisabled?: boolean;
|
|
161
|
+
scalesPageToFit?: boolean;
|
|
162
|
+
setBuiltInZoomControls?: boolean;
|
|
163
|
+
setDisplayZoomControls?: boolean;
|
|
164
|
+
setSupportMultipleWindows?: boolean;
|
|
165
|
+
textZoom?: Int32;
|
|
166
|
+
thirdPartyCookiesEnabled?: boolean;
|
|
167
|
+
// Workaround to watch if listener if defined
|
|
168
|
+
hasOnScroll?: boolean;
|
|
169
|
+
injectedJavaScriptObject?: string;
|
|
170
|
+
// !Android only
|
|
171
|
+
|
|
172
|
+
// iOS only
|
|
173
|
+
allowingReadAccessToURL?: string;
|
|
174
|
+
allowsBackForwardNavigationGestures?: boolean;
|
|
175
|
+
allowsInlineMediaPlayback?: boolean;
|
|
176
|
+
allowsAirPlayForMediaPlayback?: boolean;
|
|
177
|
+
allowsLinkPreview?: boolean;
|
|
178
|
+
automaticallyAdjustContentInsets?: boolean;
|
|
179
|
+
ignoreSilentHardwareSwitch?:boolean;
|
|
180
|
+
autoManageStatusBarEnabled?: boolean;
|
|
181
|
+
bounces?: boolean;
|
|
182
|
+
contentInset?: UnsafeMixed<Readonly<{
|
|
183
|
+
top?: Double;
|
|
184
|
+
left?: Double;
|
|
185
|
+
bottom?: Double;
|
|
186
|
+
right?: Double;
|
|
187
|
+
}>>;
|
|
188
|
+
contentInsetAdjustmentBehavior?: WithDefault<'never' | 'automatic' | 'scrollableAxes' | 'always', 'never'>;
|
|
189
|
+
contentMode?: WithDefault<'recommended' | 'mobile' | 'desktop', 'recommended'>;
|
|
190
|
+
dataDetectorTypes?: WithDefault<
|
|
191
|
+
// eslint-disable-next-line @typescript-eslint/array-type
|
|
192
|
+
UnsafeMixed<ReadonlyArray<'address' | 'link' | 'calendarEvent' | 'trackingNumber' | 'flightNumber' | 'lookupSuggestion' | 'phoneNumber' | 'all' | 'none'>>,
|
|
193
|
+
'phoneNumber'
|
|
194
|
+
>;
|
|
195
|
+
decelerationRate?: Double;
|
|
196
|
+
directionalLockEnabled?: boolean;
|
|
197
|
+
enableApplePay?: boolean;
|
|
198
|
+
hideKeyboardAccessoryView?: boolean;
|
|
199
|
+
keyboardDisplayRequiresUserAction?: boolean;
|
|
200
|
+
limitsNavigationsToAppBoundDomains?: boolean;
|
|
201
|
+
mediaCapturePermissionGrantType?: WithDefault<'prompt' | 'grant' | 'deny' | 'grantIfSameHostElsePrompt' | 'grantIfSameHostElseDeny', 'prompt'>;
|
|
202
|
+
pagingEnabled?: boolean;
|
|
203
|
+
pullToRefreshEnabled?: boolean;
|
|
204
|
+
scrollEnabled?: boolean;
|
|
205
|
+
sharedCookiesEnabled?: boolean;
|
|
206
|
+
textInteractionEnabled?: boolean;
|
|
207
|
+
useSharedProcessPool?: boolean;
|
|
208
|
+
onContentProcessDidTerminate?: DirectEventHandler<WebViewNativeEvent>;
|
|
209
|
+
onCustomMenuSelection?: DirectEventHandler<WebViewCustomMenuSelectionEvent>;
|
|
210
|
+
onFileDownload?: DirectEventHandler<WebViewDownloadEvent>;
|
|
211
|
+
// eslint-disable-next-line @typescript-eslint/array-type
|
|
212
|
+
menuItems?: UnsafeMixed<ReadonlyArray<UnsafeMixed<Readonly<{label: string, key: string}>>>>;
|
|
213
|
+
suppressMenuItems?: UnsafeMixed<Readonly<string>>[];
|
|
214
|
+
// Workaround to watch if listener if defined
|
|
215
|
+
hasOnFileDownload?: boolean;
|
|
216
|
+
fraudulentWebsiteWarningEnabled?: boolean;
|
|
217
|
+
|
|
218
|
+
// !iOS only
|
|
219
|
+
|
|
220
|
+
allowFileAccessFromFileURLs?: boolean;
|
|
221
|
+
allowUniversalAccessFromFileURLs?: boolean;
|
|
222
|
+
applicationNameForUserAgent?: string;
|
|
223
|
+
basicAuthCredential?: UnsafeMixed<Readonly<{
|
|
224
|
+
username: string;
|
|
225
|
+
password: string;
|
|
226
|
+
}>>;
|
|
227
|
+
cacheEnabled?: boolean;
|
|
228
|
+
incognito?: boolean;
|
|
229
|
+
injectedJavaScript?: string;
|
|
230
|
+
injectedJavaScriptBeforeContentLoaded?: string;
|
|
231
|
+
injectedJavaScriptForMainFrameOnly?: boolean;
|
|
232
|
+
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
|
|
233
|
+
javaScriptCanOpenWindowsAutomatically?: boolean;
|
|
234
|
+
javaScriptEnabled?: boolean;
|
|
235
|
+
webviewDebuggingEnabled?: WithDefault<boolean, false>;
|
|
236
|
+
mediaPlaybackRequiresUserAction?: boolean;
|
|
237
|
+
messagingEnabled: boolean;
|
|
238
|
+
shouldStartLoadWithRequestEnabled: boolean;
|
|
239
|
+
onLoadingError: DirectEventHandler<WebViewErrorEvent>;
|
|
240
|
+
onLoadingFinish: DirectEventHandler<WebViewNavigationEvent>;
|
|
241
|
+
onLoadingProgress: DirectEventHandler<WebViewNativeProgressEvent>;
|
|
242
|
+
onLoadingStart: DirectEventHandler<WebViewNavigationEvent>;
|
|
243
|
+
onHttpError: DirectEventHandler<WebViewHttpErrorEvent>;
|
|
244
|
+
onMessage: DirectEventHandler<WebViewMessageEvent>;
|
|
245
|
+
onOpenWindow?: DirectEventHandler<WebViewOpenWindowEvent>;
|
|
246
|
+
hasOnOpenWindowEvent?: boolean;
|
|
247
|
+
onScroll?: DirectEventHandler<ScrollEvent>;
|
|
248
|
+
onShouldStartLoadWithRequest: DirectEventHandler<ShouldStartLoadRequestEvent>;
|
|
249
|
+
showsHorizontalScrollIndicator?: boolean;
|
|
250
|
+
showsVerticalScrollIndicator?: boolean;
|
|
251
|
+
newSource: UnsafeMixed<Readonly<{
|
|
252
|
+
uri?: string
|
|
253
|
+
method?: string;
|
|
254
|
+
body?: string;
|
|
255
|
+
// eslint-disable-next-line @typescript-eslint/array-type
|
|
256
|
+
headers?: UnsafeMixed<ReadonlyArray<UnsafeMixed<Readonly<{name: string, value: string}>>>>;
|
|
257
|
+
html?: string;
|
|
258
|
+
baseUrl?: string;
|
|
259
|
+
}>>;
|
|
260
|
+
userAgent?: string;
|
|
261
|
+
schemeList?: UnsafeMixed<ReadonlyArray<string>>;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export interface NativeCommands {
|
|
265
|
+
goBack: (viewRef: React.ElementRef<HostComponent<NativeProps>> ) => void;
|
|
266
|
+
goForward: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
267
|
+
reload: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
268
|
+
stopLoading: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
269
|
+
injectJavaScript: (viewRef: React.ElementRef<HostComponent<NativeProps>>, javascript: string) => void;
|
|
270
|
+
requestFocus: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
271
|
+
postMessage: (viewRef: React.ElementRef<HostComponent<NativeProps>>, data: string) => void;
|
|
272
|
+
// Android Only
|
|
273
|
+
loadUrl: (viewRef: React.ElementRef<HostComponent<NativeProps>>, url: string) => void;
|
|
274
|
+
clearFormData: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
275
|
+
clearCache: (viewRef: React.ElementRef<HostComponent<NativeProps>>, includeDiskFiles: boolean) => void;
|
|
276
|
+
clearHistory: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
277
|
+
// !Android Only
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
281
|
+
supportedCommands: ['goBack', 'goForward', 'reload', 'stopLoading', 'injectJavaScript', 'requestFocus', 'postMessage', 'loadUrl', 'clearFormData', 'clearCache', 'clearHistory'],
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
export default codegenNativeComponent<NativeProps>(
|
|
285
|
+
'RNCWebView'
|
|
286
|
+
) as HostComponent<NativeProps>;
|