@exodus/react-native-webview 11.26.1-exodus.9 → 13.16.0-exodus.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/README.md +36 -63
- package/android/build.gradle +83 -110
- package/android/gradle.properties +3 -4
- package/android/src/main/AndroidManifest.xml +12 -0
- package/android/src/main/AndroidManifestNew.xml +26 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCBasicAuthCredential.java +11 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java +407 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebView.java +468 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewClient.java +330 -0
- package/android/src/main/java/com/reactnativecommunity/webview/{WebViewConfig.java → RNCWebViewConfig.java} +3 -4
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewFileProvider.java +1 -1
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManagerImpl.kt +746 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewMessagingModule.kt +9 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModuleImpl.java +554 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewPackage.java +57 -12
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewWrapper.kt +39 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/SubResourceErrorEvent.kt +25 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopCustomMenuSelectionEvent.kt +24 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopHttpErrorEvent.kt +25 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopNewWindowEvent.kt +25 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt +25 -0
- package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewManager.java +570 -0
- package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewModule.java +57 -0
- package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewManager.java +341 -0
- package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewModule.java +59 -0
- package/apple/RCTConvert+WKDataDetectorTypes.h +11 -0
- package/apple/RCTConvert+WKDataDetectorTypes.m +27 -0
- package/apple/RNCWebView.h +26 -100
- package/apple/RNCWebView.mm +555 -0
- package/apple/RNCWebViewDecisionManager.h +20 -0
- package/apple/RNCWebViewDecisionManager.m +47 -0
- package/apple/RNCWebViewImpl.h +164 -0
- package/apple/{RNCWebView.m → RNCWebViewImpl.m} +802 -225
- package/apple/RNCWebViewManager.h +4 -8
- package/apple/RNCWebViewManager.mm +221 -0
- package/apple/RNCWebViewModule.h +23 -0
- package/apple/RNCWebViewModule.mm +34 -0
- package/index.d.ts +2 -3
- package/lib/NativeRNCWebViewModule.d.ts +8 -0
- package/lib/NativeRNCWebViewModule.js +1 -0
- package/lib/RNCWebViewNativeComponent.d.ts +245 -0
- package/lib/RNCWebViewNativeComponent.js +1 -0
- package/lib/WebView.android.d.ts +0 -1
- package/lib/WebView.android.js +1 -135
- package/lib/WebView.d.ts +2 -3
- package/lib/WebView.ios.d.ts +0 -1
- package/lib/WebView.ios.js +1 -114
- package/lib/WebView.js +1 -11
- package/lib/WebView.macos.d.ts +6 -0
- package/lib/WebView.macos.js +1 -0
- package/lib/WebView.styles.d.ts +37 -11
- package/lib/WebView.styles.js +1 -33
- package/lib/WebView.windows.d.ts +17 -0
- package/lib/WebView.windows.js +1 -0
- package/lib/WebViewNativeComponent.macos.d.ts +3 -0
- package/lib/WebViewNativeComponent.macos.js +1 -0
- package/lib/WebViewNativeComponent.windows.d.ts +3 -0
- package/lib/WebViewNativeComponent.windows.js +1 -0
- package/lib/WebViewShared.d.ts +30 -9
- package/lib/WebViewShared.js +1 -174
- package/lib/WebViewTypes.d.ts +514 -98
- package/lib/WebViewTypes.js +1 -6
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/validation.d.ts +3 -0
- package/lib/validation.js +1 -0
- package/package.json +57 -33
- package/react-native-webview.podspec +32 -5
- package/react-native.config.js +22 -18
- package/src/NativeRNCWebViewModule.ts +13 -0
- package/src/RNCWebViewNativeComponent.ts +348 -0
- package/src/WebView.android.tsx +345 -0
- package/src/WebView.ios.tsx +341 -0
- package/src/WebView.macos.tsx +252 -0
- package/src/WebView.styles.ts +41 -0
- package/src/WebView.tsx +25 -0
- package/src/WebView.windows.tsx +217 -0
- package/src/WebViewNativeComponent.macos.ts +7 -0
- package/src/WebViewNativeComponent.windows.ts +8 -0
- package/src/WebViewShared.tsx +476 -0
- package/src/WebViewTypes.ts +1402 -0
- package/src/__tests__/WebViewShared-test.js +323 -0
- package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +8 -0
- package/src/__tests__/validation-test.js +38 -0
- package/src/index.ts +4 -0
- package/src/validation.ts +20 -0
- package/android/.editorconfig +0 -6
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java +0 -1408
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java +0 -506
- package/apple/RNCWebViewManager.m +0 -278
- package/lib/WebViewNativeComponent.android.d.ts +0 -4
- package/lib/WebViewNativeComponent.android.js +0 -3
- package/lib/WebViewNativeComponent.ios.d.ts +0 -4
- package/lib/WebViewNativeComponent.ios.js +0 -3
package/lib/WebViewTypes.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Component } from 'react';
|
|
3
|
-
export class NativeWebViewIOS extends NativeWebViewIOSBase {
|
|
4
|
-
}
|
|
5
|
-
export class NativeWebViewAndroid extends NativeWebViewAndroidBase {
|
|
6
|
-
}
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.NativeWebViewWindows=exports.NativeWebViewMacOS=void 0;var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=require("react");function _callSuper(t,o,e){return o=(0,_getPrototypeOf2.default)(o),(0,_possibleConstructorReturn2.default)(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],(0,_getPrototypeOf2.default)(t).constructor):o.apply(t,e));}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}var NativeWebViewMacOS=exports.NativeWebViewMacOS=function(_NativeWebViewMacOSBa){(0,_inherits2.default)(NativeWebViewMacOS,_NativeWebViewMacOSBa);function NativeWebViewMacOS(){(0,_classCallCheck2.default)(this,NativeWebViewMacOS);return _callSuper(this,NativeWebViewMacOS,arguments);}return(0,_createClass2.default)(NativeWebViewMacOS);}(NativeWebViewMacOSBase);var NativeWebViewWindows=exports.NativeWebViewWindows=function(_NativeWebViewWindows){(0,_inherits2.default)(NativeWebViewWindows,_NativeWebViewWindows);function NativeWebViewWindows(){(0,_classCallCheck2.default)(this,NativeWebViewWindows);return _callSuper(this,NativeWebViewWindows,arguments);}return(0,_createClass2.default)(NativeWebViewWindows);}(NativeWebViewWindowsBase);
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { WebView };
|
|
3
|
-
export default WebView;
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"WebView",{enumerable:true,get:function get(){return _WebView.default;}});exports.default=void 0;var _WebView=_interopRequireDefault(require("./WebView"));var _default=exports.default=_WebView.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _invariant=_interopRequireDefault(require("invariant"));var validateProps=function validateProps(props){if(props.source&&'html'in props.source){var originWhitelist=props.originWhitelist;(0,_invariant.default)(originWhitelist&&originWhitelist.length>0&&!originWhitelist.includes('*'),'originWhitelist is required when using source.html prop and cannot include *');}return props;};var _default=exports.default=validateProps;
|
package/package.json
CHANGED
|
@@ -3,24 +3,30 @@
|
|
|
3
3
|
"description": "React Native WebView component for iOS, Android, macOS, and Windows",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"main-internal": "src/index.ts",
|
|
6
|
+
"react-native": "src/index.ts",
|
|
6
7
|
"typings": "index.d.ts",
|
|
7
8
|
"author": "Jamon Holmgren <jamon@infinite.red>",
|
|
8
9
|
"contributors": [
|
|
9
10
|
"Thibault Malbranche <malbranche.thibault@gmail.com>"
|
|
10
11
|
],
|
|
11
12
|
"license": "MIT",
|
|
12
|
-
"version": "
|
|
13
|
+
"version": "13.16.0-exodus.1",
|
|
13
14
|
"homepage": "https://github.com/ExodusMovement/react-native-webview#readme",
|
|
14
15
|
"scripts": {
|
|
15
16
|
"android": "react-native run-android",
|
|
16
|
-
"ios": "react-native run-ios
|
|
17
|
-
"
|
|
17
|
+
"ios": "react-native run-ios",
|
|
18
|
+
"macos": "react-native run-macos --scheme WebviewExample --project-path example/macos",
|
|
19
|
+
"start": "react-native start",
|
|
20
|
+
"windows": "install-windows-test-app --project-directory example/windows && react-native run-windows --root example --arch x64",
|
|
18
21
|
"ci": "CI=true && yarn lint",
|
|
19
22
|
"ci:publish": "yarn semantic-release",
|
|
20
|
-
"lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx",
|
|
21
|
-
"build": "
|
|
22
|
-
"prepare": "
|
|
23
|
-
"
|
|
23
|
+
"lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx,.js,.jsx",
|
|
24
|
+
"build": "babel --extensions \".ts,.tsx\" --out-dir lib src",
|
|
25
|
+
"prepare:types": "tsc --noEmit false --emitDeclarationOnly --declaration --rootDir src --outDir lib",
|
|
26
|
+
"prepare": "yarn prepare:types && yarn build",
|
|
27
|
+
"appium": "appium",
|
|
28
|
+
"test:windows": "yarn jest --setupFiles=./jest-setups/jest.setup.js",
|
|
29
|
+
"add:macos": "yarn add react-native-macos@0.73.17"
|
|
24
30
|
},
|
|
25
31
|
"rn-docs": {
|
|
26
32
|
"title": "Webview",
|
|
@@ -31,38 +37,37 @@
|
|
|
31
37
|
"react-native": "*"
|
|
32
38
|
},
|
|
33
39
|
"dependencies": {
|
|
34
|
-
"escape-string-regexp": "
|
|
40
|
+
"escape-string-regexp": "^4.0.0",
|
|
35
41
|
"invariant": "2.2.4"
|
|
36
42
|
},
|
|
37
43
|
"devDependencies": {
|
|
38
|
-
"@babel/
|
|
39
|
-
"@babel/
|
|
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
|
+
"@rnx-kit/metro-config": "1.3.15",
|
|
40
53
|
"@semantic-release/git": "7.0.16",
|
|
41
54
|
"@types/invariant": "^2.2.30",
|
|
42
|
-
"@types/jest": "^
|
|
43
|
-
"@types/react": "
|
|
44
|
-
"@types/react-native": "^0.67.3",
|
|
55
|
+
"@types/jest": "^29.5.12",
|
|
56
|
+
"@types/react": "18.2.61",
|
|
45
57
|
"@types/selenium-webdriver": "4.0.9",
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "2.1.0",
|
|
47
|
-
"@typescript-eslint/parser": "2.1.0",
|
|
48
58
|
"appium": "1.17.0",
|
|
49
|
-
"eslint": "
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"jest": "^26.6.3",
|
|
58
|
-
"metro-react-native-babel-preset": "^0.67.0",
|
|
59
|
-
"react": "17.0.2",
|
|
60
|
-
"react-native": "0.68.5",
|
|
61
|
-
"react-native-test-app": "2.3.2",
|
|
59
|
+
"eslint": "8.57.0",
|
|
60
|
+
"jest": "^29.6.3",
|
|
61
|
+
"prettier": "2.8.8",
|
|
62
|
+
"react": "18.2.0",
|
|
63
|
+
"react-native": "0.73.5",
|
|
64
|
+
"react-native-macos": "0.73.17",
|
|
65
|
+
"react-native-test-app": "3.7.2",
|
|
66
|
+
"react-native-windows": "0.73.8",
|
|
62
67
|
"selenium-appium": "1.0.2",
|
|
63
68
|
"selenium-webdriver": "4.0.0-alpha.7",
|
|
64
69
|
"semantic-release": "15.13.24",
|
|
65
|
-
"typescript": "
|
|
70
|
+
"typescript": "5.1.3",
|
|
66
71
|
"winappdriver": "^0.0.7"
|
|
67
72
|
},
|
|
68
73
|
"repository": {
|
|
@@ -70,14 +75,33 @@
|
|
|
70
75
|
"url": "https://github.com/ExodusMovement/react-native-webview.git"
|
|
71
76
|
},
|
|
72
77
|
"files": [
|
|
73
|
-
"android",
|
|
78
|
+
"android/src",
|
|
79
|
+
"android/build.gradle",
|
|
80
|
+
"android/gradle.properties",
|
|
74
81
|
"apple",
|
|
75
82
|
"ios",
|
|
76
83
|
"lib",
|
|
84
|
+
"src",
|
|
77
85
|
"index.js",
|
|
78
86
|
"index.d.ts",
|
|
79
87
|
"react-native-webview.podspec",
|
|
80
|
-
"react-native.config.js"
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
"react-native.config.js"
|
|
89
|
+
],
|
|
90
|
+
"codegenConfig": {
|
|
91
|
+
"name": "RNCWebViewSpec",
|
|
92
|
+
"type": "all",
|
|
93
|
+
"jsSrcsDir": "./src",
|
|
94
|
+
"android": {
|
|
95
|
+
"javaPackageName": "com.reactnativecommunity.webview"
|
|
96
|
+
},
|
|
97
|
+
"ios": {
|
|
98
|
+
"componentProvider": {
|
|
99
|
+
"RNCWebView": "RNCWebView"
|
|
100
|
+
},
|
|
101
|
+
"modulesProvider": {
|
|
102
|
+
"RNCWebViewModule": "RNCWebViewModule"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"packageManager": "yarn@1.22.19"
|
|
83
107
|
}
|
|
@@ -1,19 +1,46 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
|
|
3
|
+
new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
4
|
+
ios_platform = new_arch_enabled ? '11.0' : '9.0'
|
|
5
|
+
|
|
3
6
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
7
|
|
|
5
8
|
Pod::Spec.new do |s|
|
|
6
|
-
s.name =
|
|
9
|
+
s.name = "react-native-webview"
|
|
7
10
|
s.version = package['version']
|
|
8
11
|
s.summary = package['description']
|
|
9
12
|
s.license = package['license']
|
|
10
13
|
|
|
11
14
|
s.authors = package['author']
|
|
12
15
|
s.homepage = package['homepage']
|
|
13
|
-
s.platforms = { :ios => "
|
|
16
|
+
s.platforms = { :ios => ios_platform, :osx => "10.13", :visionos => "1.0" }
|
|
17
|
+
|
|
18
|
+
s.source = { :git => "https://github.com/react-native-webview/react-native-webview.git", :tag => "v#{s.version}" }
|
|
19
|
+
|
|
20
|
+
s.source_files = "apple/**/*.{h,m,mm,swift}"
|
|
21
|
+
|
|
22
|
+
if defined?(install_modules_dependencies()) != nil
|
|
23
|
+
install_modules_dependencies(s);
|
|
24
|
+
else
|
|
25
|
+
if new_arch_enabled
|
|
26
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
27
|
+
|
|
28
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
14
29
|
|
|
15
|
-
|
|
16
|
-
|
|
30
|
+
s.pod_target_xcconfig = {
|
|
31
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
32
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
33
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
34
|
+
}
|
|
17
35
|
|
|
18
|
-
|
|
36
|
+
s.dependency "React-RCTFabric"
|
|
37
|
+
s.dependency "React-Codegen"
|
|
38
|
+
s.dependency "RCT-Folly"
|
|
39
|
+
s.dependency "RCTRequired"
|
|
40
|
+
s.dependency "RCTTypeSafety"
|
|
41
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
42
|
+
else
|
|
43
|
+
s.dependency "React-Core"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
19
46
|
end
|
package/react-native.config.js
CHANGED
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
const project = (() => {
|
|
2
|
-
const fs = require('fs');
|
|
3
2
|
const path = require('path');
|
|
4
3
|
try {
|
|
5
|
-
const {
|
|
6
|
-
|
|
7
|
-
iosProjectPath,
|
|
8
|
-
} = require('react-native-test-app');
|
|
9
|
-
return {
|
|
4
|
+
const { configureProjects } = require('react-native-test-app');
|
|
5
|
+
return configureProjects({
|
|
10
6
|
android: {
|
|
11
7
|
sourceDir: path.join('example', 'android'),
|
|
12
|
-
manifestPath: androidManifestPath(
|
|
13
|
-
path.join(__dirname, 'example', 'android'),
|
|
14
|
-
),
|
|
15
8
|
},
|
|
16
9
|
ios: {
|
|
17
|
-
|
|
10
|
+
sourceDir: 'example/ios',
|
|
18
11
|
},
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
windows: {
|
|
13
|
+
sourceDir: path.join('example', 'windows'),
|
|
14
|
+
solutionFile: path.join('example', 'windows', 'WebviewExample.sln'),
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
} catch (e) {
|
|
21
18
|
return undefined;
|
|
22
19
|
}
|
|
23
20
|
})();
|
|
24
21
|
|
|
25
22
|
module.exports = {
|
|
26
|
-
dependencies: {
|
|
27
|
-
// Help rn-cli find and autolink this library
|
|
28
|
-
'react-native-webview': {
|
|
29
|
-
root: __dirname,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
23
|
dependency: {
|
|
33
24
|
platforms: {
|
|
25
|
+
ios: {
|
|
26
|
+
podspecPath: __dirname + '/react-native-webview.podspec',
|
|
27
|
+
},
|
|
28
|
+
windows: {
|
|
29
|
+
sourceDir: 'windows',
|
|
30
|
+
solutionFile: 'ReactNativeWebView.sln',
|
|
31
|
+
projects: [
|
|
32
|
+
{
|
|
33
|
+
projectFile: 'ReactNativeWebView/ReactNativeWebView.vcxproj',
|
|
34
|
+
directDependency: true,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
34
38
|
},
|
|
35
39
|
},
|
|
36
40
|
...(project ? { project } : undefined),
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
isFileUploadSupported(): Promise<boolean>;
|
|
7
|
+
shouldStartLoadWithLockIdentifier(
|
|
8
|
+
shouldStart: boolean,
|
|
9
|
+
lockIdentifier: Double
|
|
10
|
+
): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNCWebViewModule');
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
3
|
+
import {
|
|
4
|
+
DirectEventHandler,
|
|
5
|
+
Double,
|
|
6
|
+
Int32,
|
|
7
|
+
WithDefault,
|
|
8
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
9
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
10
|
+
|
|
11
|
+
export type WebViewNativeEvent = Readonly<{
|
|
12
|
+
url: string;
|
|
13
|
+
loading: boolean;
|
|
14
|
+
title: string;
|
|
15
|
+
canGoBack: boolean;
|
|
16
|
+
canGoForward: boolean;
|
|
17
|
+
lockIdentifier: Double;
|
|
18
|
+
}>;
|
|
19
|
+
export type WebViewCustomMenuSelectionEvent = Readonly<{
|
|
20
|
+
label: string;
|
|
21
|
+
key: string;
|
|
22
|
+
selectedText: string;
|
|
23
|
+
}>;
|
|
24
|
+
export type WebViewMessageEvent = Readonly<{
|
|
25
|
+
url: string;
|
|
26
|
+
loading: boolean;
|
|
27
|
+
title: string;
|
|
28
|
+
canGoBack: boolean;
|
|
29
|
+
canGoForward: boolean;
|
|
30
|
+
lockIdentifier: Double;
|
|
31
|
+
data: string;
|
|
32
|
+
}>;
|
|
33
|
+
export type WebViewOpenWindowEvent = Readonly<{
|
|
34
|
+
targetUrl: string;
|
|
35
|
+
}>;
|
|
36
|
+
export type WebViewHttpErrorEvent = Readonly<{
|
|
37
|
+
url: string;
|
|
38
|
+
loading: boolean;
|
|
39
|
+
title: string;
|
|
40
|
+
canGoBack: boolean;
|
|
41
|
+
canGoForward: boolean;
|
|
42
|
+
lockIdentifier: Double;
|
|
43
|
+
description: string;
|
|
44
|
+
statusCode: Int32;
|
|
45
|
+
}>;
|
|
46
|
+
|
|
47
|
+
export type WebViewErrorEvent = Readonly<{
|
|
48
|
+
url: string;
|
|
49
|
+
loading: boolean;
|
|
50
|
+
title: string;
|
|
51
|
+
canGoBack: boolean;
|
|
52
|
+
canGoForward: boolean;
|
|
53
|
+
lockIdentifier: Double;
|
|
54
|
+
domain?: string;
|
|
55
|
+
code: Int32;
|
|
56
|
+
description: string;
|
|
57
|
+
}>;
|
|
58
|
+
|
|
59
|
+
export type WebViewNativeProgressEvent = Readonly<{
|
|
60
|
+
url: string;
|
|
61
|
+
loading: boolean;
|
|
62
|
+
title: string;
|
|
63
|
+
canGoBack: boolean;
|
|
64
|
+
canGoForward: boolean;
|
|
65
|
+
lockIdentifier: Double;
|
|
66
|
+
progress: Double;
|
|
67
|
+
}>;
|
|
68
|
+
|
|
69
|
+
export type WebViewNavigationEvent = Readonly<{
|
|
70
|
+
url: string;
|
|
71
|
+
loading: boolean;
|
|
72
|
+
title: string;
|
|
73
|
+
canGoBack: boolean;
|
|
74
|
+
canGoForward: boolean;
|
|
75
|
+
lockIdentifier: Double;
|
|
76
|
+
navigationType:
|
|
77
|
+
| 'click'
|
|
78
|
+
| 'formsubmit'
|
|
79
|
+
| 'backforward'
|
|
80
|
+
| 'reload'
|
|
81
|
+
| 'formresubmit'
|
|
82
|
+
| 'other';
|
|
83
|
+
mainDocumentURL?: string;
|
|
84
|
+
}>;
|
|
85
|
+
|
|
86
|
+
export type ShouldStartLoadRequestEvent = Readonly<{
|
|
87
|
+
url: string;
|
|
88
|
+
loading: boolean;
|
|
89
|
+
title: string;
|
|
90
|
+
canGoBack: boolean;
|
|
91
|
+
canGoForward: boolean;
|
|
92
|
+
lockIdentifier: Double;
|
|
93
|
+
navigationType:
|
|
94
|
+
| 'click'
|
|
95
|
+
| 'formsubmit'
|
|
96
|
+
| 'backforward'
|
|
97
|
+
| 'reload'
|
|
98
|
+
| 'formresubmit'
|
|
99
|
+
| 'other';
|
|
100
|
+
mainDocumentURL?: string;
|
|
101
|
+
isTopFrame: boolean;
|
|
102
|
+
}>;
|
|
103
|
+
|
|
104
|
+
type ScrollEvent = Readonly<{
|
|
105
|
+
contentInset: {
|
|
106
|
+
bottom: Double;
|
|
107
|
+
left: Double;
|
|
108
|
+
right: Double;
|
|
109
|
+
top: Double;
|
|
110
|
+
};
|
|
111
|
+
contentOffset: {
|
|
112
|
+
y: Double;
|
|
113
|
+
x: Double;
|
|
114
|
+
};
|
|
115
|
+
contentSize: {
|
|
116
|
+
height: Double;
|
|
117
|
+
width: Double;
|
|
118
|
+
};
|
|
119
|
+
layoutMeasurement: {
|
|
120
|
+
height: Double;
|
|
121
|
+
width: Double;
|
|
122
|
+
};
|
|
123
|
+
targetContentOffset?: {
|
|
124
|
+
y: Double;
|
|
125
|
+
x: Double;
|
|
126
|
+
};
|
|
127
|
+
velocity?: {
|
|
128
|
+
y: Double;
|
|
129
|
+
x: Double;
|
|
130
|
+
};
|
|
131
|
+
zoomScale?: Double;
|
|
132
|
+
responderIgnoreScroll?: boolean;
|
|
133
|
+
}>;
|
|
134
|
+
|
|
135
|
+
type WebViewRenderProcessGoneEvent = Readonly<{
|
|
136
|
+
didCrash: boolean;
|
|
137
|
+
}>;
|
|
138
|
+
|
|
139
|
+
type WebViewDownloadEvent = Readonly<{
|
|
140
|
+
downloadUrl: string;
|
|
141
|
+
}>;
|
|
142
|
+
|
|
143
|
+
// type MenuItem = Readonly<{label: string, key: string}>;
|
|
144
|
+
|
|
145
|
+
export interface NativeProps extends ViewProps {
|
|
146
|
+
// Android only
|
|
147
|
+
allowFileAccess?: boolean;
|
|
148
|
+
allowsProtectedMedia?: boolean;
|
|
149
|
+
allowsFullscreenVideo?: boolean;
|
|
150
|
+
androidLayerType?: WithDefault<'none' | 'software' | 'hardware', 'none'>;
|
|
151
|
+
cacheMode?: WithDefault<
|
|
152
|
+
| 'LOAD_DEFAULT'
|
|
153
|
+
| 'LOAD_CACHE_ELSE_NETWORK'
|
|
154
|
+
| 'LOAD_NO_CACHE'
|
|
155
|
+
| 'LOAD_CACHE_ONLY',
|
|
156
|
+
'LOAD_DEFAULT'
|
|
157
|
+
>;
|
|
158
|
+
domStorageEnabled?: boolean;
|
|
159
|
+
downloadingMessage?: string;
|
|
160
|
+
forceDarkOn?: boolean;
|
|
161
|
+
geolocationEnabled?: boolean;
|
|
162
|
+
lackPermissionToDownloadMessage?: string;
|
|
163
|
+
messagingModuleName: string;
|
|
164
|
+
minimumFontSize?: Int32;
|
|
165
|
+
mixedContentMode?: WithDefault<'never' | 'always' | 'compatibility', 'never'>;
|
|
166
|
+
nestedScrollEnabled?: boolean;
|
|
167
|
+
onContentSizeChange?: DirectEventHandler<WebViewNativeEvent>;
|
|
168
|
+
onRenderProcessGone?: DirectEventHandler<WebViewRenderProcessGoneEvent>;
|
|
169
|
+
overScrollMode?: string;
|
|
170
|
+
saveFormDataDisabled?: boolean;
|
|
171
|
+
scalesPageToFit?: WithDefault<boolean, true>;
|
|
172
|
+
setBuiltInZoomControls?: WithDefault<boolean, true>;
|
|
173
|
+
setDisplayZoomControls?: boolean;
|
|
174
|
+
setSupportMultipleWindows?: WithDefault<boolean, true>;
|
|
175
|
+
textZoom?: Int32;
|
|
176
|
+
thirdPartyCookiesEnabled?: WithDefault<boolean, true>;
|
|
177
|
+
// Workaround to watch if listener if defined
|
|
178
|
+
hasOnScroll?: boolean;
|
|
179
|
+
// !Android only
|
|
180
|
+
|
|
181
|
+
// iOS only
|
|
182
|
+
allowingReadAccessToURL?: string;
|
|
183
|
+
allowsBackForwardNavigationGestures?: boolean;
|
|
184
|
+
allowsInlineMediaPlayback?: boolean;
|
|
185
|
+
allowsPictureInPictureMediaPlayback?: boolean;
|
|
186
|
+
allowsAirPlayForMediaPlayback?: boolean;
|
|
187
|
+
allowsLinkPreview?: WithDefault<boolean, true>;
|
|
188
|
+
automaticallyAdjustContentInsets?: WithDefault<boolean, true>;
|
|
189
|
+
autoManageStatusBarEnabled?: WithDefault<boolean, true>;
|
|
190
|
+
bounces?: WithDefault<boolean, true>;
|
|
191
|
+
contentInset?: Readonly<{
|
|
192
|
+
top?: Double;
|
|
193
|
+
left?: Double;
|
|
194
|
+
bottom?: Double;
|
|
195
|
+
right?: Double;
|
|
196
|
+
}>;
|
|
197
|
+
contentInsetAdjustmentBehavior?: WithDefault<
|
|
198
|
+
'never' | 'automatic' | 'scrollableAxes' | 'always',
|
|
199
|
+
'never'
|
|
200
|
+
>;
|
|
201
|
+
contentMode?: WithDefault<
|
|
202
|
+
'recommended' | 'mobile' | 'desktop',
|
|
203
|
+
'recommended'
|
|
204
|
+
>;
|
|
205
|
+
dataDetectorTypes?: WithDefault<
|
|
206
|
+
ReadonlyArray<
|
|
207
|
+
| 'address'
|
|
208
|
+
| 'link'
|
|
209
|
+
| 'calendarEvent'
|
|
210
|
+
| 'trackingNumber'
|
|
211
|
+
| 'flightNumber'
|
|
212
|
+
| 'lookupSuggestion'
|
|
213
|
+
| 'phoneNumber'
|
|
214
|
+
| 'all'
|
|
215
|
+
| 'none'
|
|
216
|
+
>,
|
|
217
|
+
'phoneNumber'
|
|
218
|
+
>;
|
|
219
|
+
decelerationRate?: Double;
|
|
220
|
+
directionalLockEnabled?: WithDefault<boolean, true>;
|
|
221
|
+
enableApplePay?: boolean;
|
|
222
|
+
hideKeyboardAccessoryView?: boolean;
|
|
223
|
+
keyboardDisplayRequiresUserAction?: WithDefault<boolean, true>;
|
|
224
|
+
limitsNavigationsToAppBoundDomains?: boolean;
|
|
225
|
+
mediaCapturePermissionGrantType?: WithDefault<
|
|
226
|
+
| 'prompt'
|
|
227
|
+
| 'grant'
|
|
228
|
+
| 'deny'
|
|
229
|
+
| 'grantIfSameHostElsePrompt'
|
|
230
|
+
| 'grantIfSameHostElseDeny',
|
|
231
|
+
'prompt'
|
|
232
|
+
>;
|
|
233
|
+
pagingEnabled?: boolean;
|
|
234
|
+
pullToRefreshEnabled?: boolean;
|
|
235
|
+
refreshControlLightMode?: boolean;
|
|
236
|
+
scrollEnabled?: WithDefault<boolean, true>;
|
|
237
|
+
sharedCookiesEnabled?: boolean;
|
|
238
|
+
textInteractionEnabled?: WithDefault<boolean, true>;
|
|
239
|
+
useSharedProcessPool?: WithDefault<boolean, true>;
|
|
240
|
+
onContentProcessDidTerminate?: DirectEventHandler<WebViewNativeEvent>;
|
|
241
|
+
onCustomMenuSelection?: DirectEventHandler<WebViewCustomMenuSelectionEvent>;
|
|
242
|
+
onFileDownload?: DirectEventHandler<WebViewDownloadEvent>;
|
|
243
|
+
|
|
244
|
+
menuItems?: ReadonlyArray<Readonly<{ label: string; key: string }>>;
|
|
245
|
+
suppressMenuItems?: Readonly<string>[];
|
|
246
|
+
// Workaround to watch if listener if defined
|
|
247
|
+
hasOnFileDownload?: boolean;
|
|
248
|
+
fraudulentWebsiteWarningEnabled?: WithDefault<boolean, true>;
|
|
249
|
+
// !iOS only
|
|
250
|
+
|
|
251
|
+
allowFileAccessFromFileURLs?: boolean;
|
|
252
|
+
allowUniversalAccessFromFileURLs?: boolean;
|
|
253
|
+
applicationNameForUserAgent?: string;
|
|
254
|
+
basicAuthCredential?: Readonly<{
|
|
255
|
+
username: string;
|
|
256
|
+
password: string;
|
|
257
|
+
}>;
|
|
258
|
+
cacheEnabled?: WithDefault<boolean, true>;
|
|
259
|
+
incognito?: boolean;
|
|
260
|
+
injectedJavaScript?: string;
|
|
261
|
+
injectedJavaScriptBeforeContentLoaded?: string;
|
|
262
|
+
injectedJavaScriptForMainFrameOnly?: WithDefault<boolean, true>;
|
|
263
|
+
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: WithDefault<
|
|
264
|
+
boolean,
|
|
265
|
+
true
|
|
266
|
+
>;
|
|
267
|
+
javaScriptCanOpenWindowsAutomatically?: boolean;
|
|
268
|
+
javaScriptEnabled?: WithDefault<boolean, true>;
|
|
269
|
+
webviewDebuggingEnabled?: boolean;
|
|
270
|
+
mediaPlaybackRequiresUserAction?: WithDefault<boolean, true>;
|
|
271
|
+
messagingEnabled: boolean;
|
|
272
|
+
onLoadingError: DirectEventHandler<WebViewErrorEvent>;
|
|
273
|
+
onLoadingSubResourceError: DirectEventHandler<WebViewErrorEvent>;
|
|
274
|
+
onLoadingFinish: DirectEventHandler<WebViewNavigationEvent>;
|
|
275
|
+
onLoadingProgress: DirectEventHandler<WebViewNativeProgressEvent>;
|
|
276
|
+
onLoadingStart: DirectEventHandler<WebViewNavigationEvent>;
|
|
277
|
+
onHttpError: DirectEventHandler<WebViewHttpErrorEvent>;
|
|
278
|
+
onMessage: DirectEventHandler<WebViewMessageEvent>;
|
|
279
|
+
onOpenWindow?: DirectEventHandler<WebViewOpenWindowEvent>;
|
|
280
|
+
hasOnOpenWindowEvent?: boolean;
|
|
281
|
+
onScroll?: DirectEventHandler<ScrollEvent>;
|
|
282
|
+
onShouldStartLoadWithRequest: DirectEventHandler<ShouldStartLoadRequestEvent>;
|
|
283
|
+
showsHorizontalScrollIndicator?: WithDefault<boolean, true>;
|
|
284
|
+
showsVerticalScrollIndicator?: WithDefault<boolean, true>;
|
|
285
|
+
indicatorStyle?: WithDefault<'default' | 'black' | 'white', 'default'>;
|
|
286
|
+
newSource: Readonly<{
|
|
287
|
+
uri?: string;
|
|
288
|
+
method?: string;
|
|
289
|
+
body?: string;
|
|
290
|
+
|
|
291
|
+
headers?: ReadonlyArray<Readonly<{ name: string; value: string }>>;
|
|
292
|
+
html?: string;
|
|
293
|
+
baseUrl?: string;
|
|
294
|
+
}>;
|
|
295
|
+
userAgent?: string;
|
|
296
|
+
injectedJavaScriptObject?: string;
|
|
297
|
+
paymentRequestEnabled?: boolean;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export interface NativeCommands {
|
|
301
|
+
goBack: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
302
|
+
goForward: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
303
|
+
reload: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
304
|
+
stopLoading: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
305
|
+
injectJavaScript: (
|
|
306
|
+
viewRef: React.ElementRef<HostComponent<NativeProps>>,
|
|
307
|
+
javascript: string
|
|
308
|
+
) => void;
|
|
309
|
+
requestFocus: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
310
|
+
postMessage: (
|
|
311
|
+
viewRef: React.ElementRef<HostComponent<NativeProps>>,
|
|
312
|
+
data: string
|
|
313
|
+
) => void;
|
|
314
|
+
// Android Only
|
|
315
|
+
loadUrl: (
|
|
316
|
+
viewRef: React.ElementRef<HostComponent<NativeProps>>,
|
|
317
|
+
url: string
|
|
318
|
+
) => void;
|
|
319
|
+
clearFormData: (
|
|
320
|
+
viewRef: React.ElementRef<HostComponent<NativeProps>>
|
|
321
|
+
) => void;
|
|
322
|
+
clearCache: (
|
|
323
|
+
viewRef: React.ElementRef<HostComponent<NativeProps>>,
|
|
324
|
+
includeDiskFiles: boolean
|
|
325
|
+
) => void;
|
|
326
|
+
clearHistory: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
327
|
+
// !Android Only
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
331
|
+
supportedCommands: [
|
|
332
|
+
'goBack',
|
|
333
|
+
'goForward',
|
|
334
|
+
'reload',
|
|
335
|
+
'stopLoading',
|
|
336
|
+
'injectJavaScript',
|
|
337
|
+
'requestFocus',
|
|
338
|
+
'postMessage',
|
|
339
|
+
'loadUrl',
|
|
340
|
+
'clearFormData',
|
|
341
|
+
'clearCache',
|
|
342
|
+
'clearHistory',
|
|
343
|
+
],
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
export default codegenNativeComponent<NativeProps>(
|
|
347
|
+
'RNCWebView'
|
|
348
|
+
) as HostComponent<NativeProps>;
|