@exodus/react-native-webview 11.26.1-exodus.30 → 11.26.1-exodus.32
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/.all-contributorsrc +185 -0
- package/.circleci/config.yml +66 -0
- package/.eslintignore +2 -0
- package/.eslintrc.js +94 -0
- package/.flowconfig +88 -0
- package/.flowconfig.android +88 -0
- package/.gitattributes +12 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/ISSUE_TEMPLATE/bug-report.md +42 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +30 -0
- package/.github/workflows/android-ci.yml +35 -0
- package/.github/workflows/detox.yml +20 -0
- package/.github/workflows/ios-ci.yml +31 -0
- package/.github/workflows/scripts/install-vs-features.ps1 +108 -0
- package/.github/workflows/stale.yml +17 -0
- package/.gitignore +62 -0
- package/.idea/.gitignore +5 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/misc.xml +9 -0
- package/.idea/modules.xml +8 -0
- package/.idea/react-native-webview.iml +9 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/workspace.xml +104 -0
- package/.prettierrc.js +10 -0
- package/.releaserc +15 -0
- package/.vscode/settings.json +9 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java +6 -0
- package/apple/RNCWebView.m +16 -1
- package/babel.config.js +11 -0
- package/bin/setup +26 -0
- package/docs/Contributing.md +102 -0
- package/docs/Custom-Android.md +222 -0
- package/docs/Custom-iOS.md +236 -0
- package/docs/Debugging.md +101 -0
- package/docs/Getting-Started.md +142 -0
- package/docs/Guide.md +613 -0
- package/docs/Reference.md +1639 -0
- package/example/.gitignore +14 -0
- package/example/.watchmanconfig +1 -0
- package/example/App.tsx +262 -0
- package/example/android/build.gradle +15 -0
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/example/android/gradle.properties +34 -0
- package/example/android/gradlew +234 -0
- package/example/android/gradlew.bat +89 -0
- package/example/android/settings.gradle +12 -0
- package/example/app.json +20 -0
- package/example/assets/test.html +9 -0
- package/example/babel.config.js +3 -0
- package/example/examples/Alerts.tsx +72 -0
- package/example/examples/ApplePay.tsx +23 -0
- package/example/examples/Background.tsx +54 -0
- package/example/examples/Downloads.tsx +57 -0
- package/example/examples/Injection.tsx +161 -0
- package/example/examples/LocalPageLoad.tsx +16 -0
- package/example/examples/Messaging.tsx +63 -0
- package/example/examples/NativeWebpage.tsx +22 -0
- package/example/examples/Scrolling.tsx +68 -0
- package/example/examples/Uploads.tsx +69 -0
- package/example/index.js +9 -0
- package/example/ios/Podfile +8 -0
- package/example/ios/Podfile.lock +445 -0
- package/jest-setups/jest.setup.js +8 -0
- package/jest.config.js +184 -0
- package/lib/WebView.android.d.ts.map +1 -0
- package/lib/WebView.android.js +5 -6
- package/lib/WebView.d.ts.map +1 -0
- package/lib/WebView.ios.d.ts.map +1 -0
- package/lib/WebView.ios.js +3 -1
- package/lib/WebView.styles.d.ts.map +1 -0
- package/lib/WebViewNativeComponent.android.d.ts.map +1 -0
- package/lib/WebViewNativeComponent.ios.d.ts.map +1 -0
- package/lib/WebViewShared.d.ts.map +1 -0
- package/lib/WebViewTypes.d.ts.map +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/validation.d.ts +4 -0
- package/lib/validation.d.ts.map +1 -0
- package/lib/validation.js +9 -0
- package/metro.config.js +57 -0
- package/package.json +1 -1
- package/src/WebView.android.tsx +255 -0
- package/src/WebView.ios.tsx +230 -0
- package/src/WebView.styles.ts +44 -0
- package/src/WebView.tsx +18 -0
- package/src/WebViewNativeComponent.android.ts +8 -0
- package/src/WebViewNativeComponent.ios.ts +8 -0
- package/src/WebViewShared.tsx +318 -0
- package/src/WebViewTypes.ts +941 -0
- package/src/__tests__/WebViewShared-test.js +292 -0
- package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +13 -0
- package/src/__tests__/validation-test.js +39 -0
- package/src/index.ts +4 -0
- package/src/validation.ts +13 -0
- package/tsconfig.json +24 -0
- package/yarn.lock +13397 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: iOS
|
|
2
|
+
on: [push, pull_request]
|
|
3
|
+
jobs:
|
|
4
|
+
build:
|
|
5
|
+
runs-on: macos-12
|
|
6
|
+
steps:
|
|
7
|
+
- name: Checkout
|
|
8
|
+
uses: actions/checkout@v2
|
|
9
|
+
- name: Set up Node.js
|
|
10
|
+
uses: actions/setup-node@v2.5.1
|
|
11
|
+
with:
|
|
12
|
+
node-version: 16
|
|
13
|
+
- name: Cache /node_modules
|
|
14
|
+
uses: actions/cache@v2
|
|
15
|
+
with:
|
|
16
|
+
path: node_modules
|
|
17
|
+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
|
|
18
|
+
- name: Install npm dependencies
|
|
19
|
+
run: yarn --frozen-lockfile
|
|
20
|
+
- name: Install Pods
|
|
21
|
+
run: pod install
|
|
22
|
+
working-directory: example/ios
|
|
23
|
+
- name: Build iOS test app
|
|
24
|
+
run: |
|
|
25
|
+
device_name='iPhone 13'
|
|
26
|
+
device=$(xcrun simctl list devices "${device_name}" available | grep "${device_name} (")
|
|
27
|
+
re='\(([-0-9A-Fa-f]+)\)'
|
|
28
|
+
[[ $device =~ $re ]] || exit 1
|
|
29
|
+
xcodebuild -workspace WebviewExample.xcworkspace -scheme ReactTestApp -destination "platform=iOS Simulator,id=${BASH_REMATCH[1]}" CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO build
|
|
30
|
+
working-directory: example/ios
|
|
31
|
+
timeout-minutes: 60
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
param (
|
|
2
|
+
[Parameter(Mandatory=$true)]
|
|
3
|
+
[string[]] $Components,
|
|
4
|
+
|
|
5
|
+
[uri] $InstallerUri = "https://download.visualstudio.microsoft.com/download/pr/c4fef23e-cc45-4836-9544-70e213134bc8/1ee5717e9a1e05015756dff77eb27d554a79a6db91f2716d836df368381af9a1/vs_Enterprise.exe",
|
|
6
|
+
|
|
7
|
+
[string] $VsInstaller = "${env:System_DefaultWorkingDirectory}\vs_Enterprise.exe",
|
|
8
|
+
|
|
9
|
+
[string] $VsInstallOutputDir = "${env:System_DefaultWorkingDirectory}\vs",
|
|
10
|
+
|
|
11
|
+
[System.IO.FileInfo] $VsInstallPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Enterprise",
|
|
12
|
+
|
|
13
|
+
[System.IO.FileInfo] $VsInstallerPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer",
|
|
14
|
+
|
|
15
|
+
[switch] $Collect = $false,
|
|
16
|
+
|
|
17
|
+
[switch] $Cleanup = $false,
|
|
18
|
+
|
|
19
|
+
[switch] $UseWebInstaller = $false
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
$Components | ForEach-Object {
|
|
23
|
+
$componentList += '--add', $_
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
$LocalVsInstaller = "$VsInstallerPath\vs_installershell.exe"
|
|
27
|
+
|
|
28
|
+
$UseWebInstaller = $UseWebInstaller -or -not (Test-Path -Path "$LocalVsInstaller")
|
|
29
|
+
|
|
30
|
+
if ($UseWebInstaller) {
|
|
31
|
+
Write-Host "Downloading web installer..."
|
|
32
|
+
|
|
33
|
+
Invoke-WebRequest -Method Get `
|
|
34
|
+
-Uri $InstallerUri `
|
|
35
|
+
-OutFile $VsInstaller
|
|
36
|
+
|
|
37
|
+
New-Item -ItemType directory -Path $VsInstallOutputDir
|
|
38
|
+
|
|
39
|
+
Write-Host "Running web installer to download requested components..."
|
|
40
|
+
|
|
41
|
+
Start-Process `
|
|
42
|
+
-FilePath "$VsInstaller" `
|
|
43
|
+
-ArgumentList ( `
|
|
44
|
+
'--layout', "$VsInstallOutputDir",
|
|
45
|
+
'--wait',
|
|
46
|
+
'--norestart',
|
|
47
|
+
'--quiet' + `
|
|
48
|
+
$componentList
|
|
49
|
+
) `
|
|
50
|
+
-Wait `
|
|
51
|
+
-PassThru
|
|
52
|
+
|
|
53
|
+
Write-Host "Running downloaded VS installer to add requested components..."
|
|
54
|
+
|
|
55
|
+
Start-Process `
|
|
56
|
+
-FilePath "$VsInstallOutputDir\vs_Enterprise.exe" `
|
|
57
|
+
-ArgumentList (
|
|
58
|
+
'modify',
|
|
59
|
+
'--installPath', "`"$VsInstallPath`"" ,
|
|
60
|
+
'--wait',
|
|
61
|
+
'--norestart',
|
|
62
|
+
'--quiet' + `
|
|
63
|
+
$componentList
|
|
64
|
+
) `
|
|
65
|
+
-Wait `
|
|
66
|
+
-PassThru `
|
|
67
|
+
-OutVariable returnCode
|
|
68
|
+
|
|
69
|
+
if ($Cleanup) {
|
|
70
|
+
Write-Host "Cleaning up..."
|
|
71
|
+
|
|
72
|
+
Remove-Item -Path $VsInstaller
|
|
73
|
+
Remove-Item -Path $VsInstallOutputDir -Recurse
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
} else {
|
|
77
|
+
Write-Host "Running local installer to add requested components..."
|
|
78
|
+
|
|
79
|
+
Start-Process `
|
|
80
|
+
-FilePath "$LocalVsInstaller" `
|
|
81
|
+
-ArgumentList (
|
|
82
|
+
'modify',
|
|
83
|
+
'--installPath', "`"$VsInstallPath`"" ,
|
|
84
|
+
'--norestart',
|
|
85
|
+
'--quiet' + `
|
|
86
|
+
$componentList
|
|
87
|
+
) `
|
|
88
|
+
-Wait `
|
|
89
|
+
-OutVariable returnCode
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if ($Collect) {
|
|
93
|
+
Invoke-WebRequest -Method Get `
|
|
94
|
+
-Uri 'https://download.microsoft.com/download/8/3/4/834E83F6-C377-4DCE-A757-69A418B6C6DF/Collect.exe' `
|
|
95
|
+
-OutFile ${env:System_DefaultWorkingDirectory}\Collect.exe
|
|
96
|
+
|
|
97
|
+
# Should generate ${env:Temp}\vslogs.zip
|
|
98
|
+
Start-Process `
|
|
99
|
+
-FilePath "${env:System_DefaultWorkingDirectory}\Collect.exe" `
|
|
100
|
+
-Wait `
|
|
101
|
+
-PassThru
|
|
102
|
+
|
|
103
|
+
New-Item -ItemType Directory -Force ${env:System_DefaultWorkingDirectory}\vslogs
|
|
104
|
+
Expand-Archive -Path ${env:TEMP}\vslogs.zip -DestinationPath ${env:System_DefaultWorkingDirectory}\vslogs\
|
|
105
|
+
|
|
106
|
+
Write-Host "VC versions after installation:"
|
|
107
|
+
Get-ChildItem -Name "$VsInstallPath\VC\Tools\MSVC\"
|
|
108
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: "Close stale issues and PRs"
|
|
2
|
+
on:
|
|
3
|
+
schedule:
|
|
4
|
+
- cron: "0 0 * * *"
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
stale:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/stale@v3.0.14
|
|
11
|
+
with:
|
|
12
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
13
|
+
stale-issue-message: 'Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like _still searching for solutions_ and if you found one, please open a pull request! You have 7 days until this gets closed automatically'
|
|
14
|
+
stale-pr-message: 'Hello 👋, this PR has been opened for more than 2 months with no activity on it. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically'
|
|
15
|
+
exempt-issue-label: 'Keep opened'
|
|
16
|
+
exempt-pr-label: 'Keep opened'
|
|
17
|
+
remove-stale-when-updated: true
|
package/.gitignore
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# OSX
|
|
2
|
+
#
|
|
3
|
+
.DS_Store
|
|
4
|
+
|
|
5
|
+
# Xcode
|
|
6
|
+
#
|
|
7
|
+
.xcode.env
|
|
8
|
+
build/
|
|
9
|
+
*.pbxuser
|
|
10
|
+
!default.pbxuser
|
|
11
|
+
*.mode1v3
|
|
12
|
+
!default.mode1v3
|
|
13
|
+
*.mode2v3
|
|
14
|
+
!default.mode2v3
|
|
15
|
+
*.perspectivev3
|
|
16
|
+
!default.perspectivev3
|
|
17
|
+
xcuserdata
|
|
18
|
+
*.xccheckout
|
|
19
|
+
*.moved-aside
|
|
20
|
+
DerivedData
|
|
21
|
+
*.hmap
|
|
22
|
+
*.ipa
|
|
23
|
+
*.xcuserstate
|
|
24
|
+
project.xcworkspace
|
|
25
|
+
Pods/
|
|
26
|
+
|
|
27
|
+
# Android/IJ
|
|
28
|
+
#
|
|
29
|
+
.idea
|
|
30
|
+
*.iml
|
|
31
|
+
.gradle
|
|
32
|
+
local.properties
|
|
33
|
+
lib/android/src/main/gen
|
|
34
|
+
|
|
35
|
+
# node.js
|
|
36
|
+
#
|
|
37
|
+
node_modules/
|
|
38
|
+
npm-debug.log
|
|
39
|
+
yarn-error.log
|
|
40
|
+
package-lock.json
|
|
41
|
+
|
|
42
|
+
# Rubygem bundles
|
|
43
|
+
#
|
|
44
|
+
bundles/
|
|
45
|
+
|
|
46
|
+
# VS Code
|
|
47
|
+
.vscode/*
|
|
48
|
+
!.vscode/settings.json
|
|
49
|
+
!.vscode/tasks.json
|
|
50
|
+
!.vscode/launch.json
|
|
51
|
+
!.vscode/extensions.json
|
|
52
|
+
|
|
53
|
+
android/gradle
|
|
54
|
+
android/gradlew
|
|
55
|
+
android/gradlew.bat
|
|
56
|
+
|
|
57
|
+
lib/
|
|
58
|
+
.classpath
|
|
59
|
+
.project
|
|
60
|
+
.settings/
|
|
61
|
+
msbuild.binlog
|
|
62
|
+
example/msbuild.binlog
|
package/.idea/.gitignore
ADDED
package/.idea/misc.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="JavaScriptSettings">
|
|
4
|
+
<option name="languageLevel" value="FLOW" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectRootManager">
|
|
7
|
+
<output url="file://$PROJECT_DIR$/out" />
|
|
8
|
+
</component>
|
|
9
|
+
</project>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/react-native-webview.iml" filepath="$PROJECT_DIR$/.idea/react-native-webview.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
|
6
|
+
<orderEntry type="inheritedJdk" />
|
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
+
</component>
|
|
9
|
+
</module>
|
package/.idea/vcs.xml
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="AutoImportSettings">
|
|
4
|
+
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ChangeListManager">
|
|
7
|
+
<list default="true" id="a74e406d-9716-4781-b400-a88557c6b8e3" name="Changes" comment="" />
|
|
8
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
9
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
11
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="Git.Settings">
|
|
14
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
15
|
+
</component>
|
|
16
|
+
<component name="ProjectColorInfo"><![CDATA[{
|
|
17
|
+
"associatedIndex": 2
|
|
18
|
+
}]]></component>
|
|
19
|
+
<component name="ProjectId" id="2pTxCq1zeXEcMZgmLQCB7U9wQAb" />
|
|
20
|
+
<component name="ProjectViewState">
|
|
21
|
+
<option name="autoscrollToSource" value="true" />
|
|
22
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
23
|
+
<option name="showLibraryContents" value="true" />
|
|
24
|
+
</component>
|
|
25
|
+
<component name="PropertiesComponent"><![CDATA[{
|
|
26
|
+
"keyToString": {
|
|
27
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
28
|
+
"git-widget-placeholder": "sparten11740/revert/remove-static-html-support",
|
|
29
|
+
"kotlin-language-version-configured": "true",
|
|
30
|
+
"last_opened_file_path": "/Users/janexodus/workspace/react-native-webview",
|
|
31
|
+
"node.js.detected.package.eslint": "true",
|
|
32
|
+
"node.js.detected.package.tslint": "true",
|
|
33
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
34
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
35
|
+
"nodejs_package_manager_path": "yarn",
|
|
36
|
+
"ts.external.directory.path": "/Users/janexodus/workspace/react-native-webview/node_modules/typescript/lib"
|
|
37
|
+
}
|
|
38
|
+
}]]></component>
|
|
39
|
+
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
40
|
+
<component name="TaskManager">
|
|
41
|
+
<task active="true" id="Default" summary="Default task">
|
|
42
|
+
<changelist id="a74e406d-9716-4781-b400-a88557c6b8e3" name="Changes" comment="" />
|
|
43
|
+
<created>1732803742926</created>
|
|
44
|
+
<option name="number" value="Default" />
|
|
45
|
+
<option name="presentableId" value="Default" />
|
|
46
|
+
<updated>1732803742926</updated>
|
|
47
|
+
<workItem from="1732803744417" duration="4239000" />
|
|
48
|
+
</task>
|
|
49
|
+
<servers />
|
|
50
|
+
</component>
|
|
51
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
52
|
+
<option name="version" value="3" />
|
|
53
|
+
</component>
|
|
54
|
+
<component name="Vcs.Log.Tabs.Properties">
|
|
55
|
+
<option name="RECENT_FILTERS">
|
|
56
|
+
<map>
|
|
57
|
+
<entry key="Branch">
|
|
58
|
+
<value>
|
|
59
|
+
<list>
|
|
60
|
+
<RecentGroup>
|
|
61
|
+
<option name="FILTER_VALUES">
|
|
62
|
+
<option value="HEAD" />
|
|
63
|
+
</option>
|
|
64
|
+
</RecentGroup>
|
|
65
|
+
<RecentGroup>
|
|
66
|
+
<option name="FILTER_VALUES">
|
|
67
|
+
<option value="master" />
|
|
68
|
+
</option>
|
|
69
|
+
</RecentGroup>
|
|
70
|
+
</list>
|
|
71
|
+
</value>
|
|
72
|
+
</entry>
|
|
73
|
+
</map>
|
|
74
|
+
</option>
|
|
75
|
+
<option name="TAB_STATES">
|
|
76
|
+
<map>
|
|
77
|
+
<entry key="MAIN">
|
|
78
|
+
<value>
|
|
79
|
+
<State>
|
|
80
|
+
<option name="FILTERS">
|
|
81
|
+
<map>
|
|
82
|
+
<entry key="branch">
|
|
83
|
+
<value>
|
|
84
|
+
<list>
|
|
85
|
+
<option value="HEAD" />
|
|
86
|
+
</list>
|
|
87
|
+
</value>
|
|
88
|
+
</entry>
|
|
89
|
+
<entry key="text">
|
|
90
|
+
<value>
|
|
91
|
+
<list>
|
|
92
|
+
<option value="html" />
|
|
93
|
+
</list>
|
|
94
|
+
</value>
|
|
95
|
+
</entry>
|
|
96
|
+
</map>
|
|
97
|
+
</option>
|
|
98
|
+
</State>
|
|
99
|
+
</value>
|
|
100
|
+
</entry>
|
|
101
|
+
</map>
|
|
102
|
+
</option>
|
|
103
|
+
</component>
|
|
104
|
+
</project>
|
package/.prettierrc.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// https://prettier.io/docs/en/options.html
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
// Enables semicolons at the end of statements
|
|
5
|
+
semi: true,
|
|
6
|
+
// Formats strings with single quotes ('') instead of quotes ("")
|
|
7
|
+
singleQuote: true,
|
|
8
|
+
// Adds a trailing comma at the end of all lists (including function arguments)
|
|
9
|
+
trailingComma: 'all',
|
|
10
|
+
};
|
package/.releaserc
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins": [
|
|
3
|
+
"@semantic-release/commit-analyzer",
|
|
4
|
+
"@semantic-release/release-notes-generator",
|
|
5
|
+
"@semantic-release/npm",
|
|
6
|
+
"@semantic-release/github",
|
|
7
|
+
[
|
|
8
|
+
"@semantic-release/git",
|
|
9
|
+
{
|
|
10
|
+
"assets": "package.json",
|
|
11
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -445,6 +445,12 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
|
|
445
445
|
@ReactProp(name = "source")
|
|
446
446
|
public void setSource(WebView view, @Nullable ReadableMap source) {
|
|
447
447
|
if (source != null) {
|
|
448
|
+
if (source.hasKey("html")) {
|
|
449
|
+
String html = source.getString("html");
|
|
450
|
+
String baseUrl = source.hasKey("baseUrl") ? source.getString("baseUrl") : "";
|
|
451
|
+
view.loadDataWithBaseURL(baseUrl, html, HTML_MIME_TYPE, HTML_ENCODING, null);
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
448
454
|
if (source.hasKey("uri")) {
|
|
449
455
|
String url = source.getString("uri");
|
|
450
456
|
String previousUrl = view.getUrl();
|
package/apple/RNCWebView.m
CHANGED
|
@@ -582,8 +582,13 @@ RCTAutoInsetsProtocol>
|
|
|
582
582
|
#endif
|
|
583
583
|
|
|
584
584
|
- (NSMutableDictionary<NSString *, id> *)baseEventWithScriptMessage:(WKScriptMessage *)message {
|
|
585
|
+
WKSecurityOrigin *securityOrigin = message.frameInfo.securityOrigin;
|
|
586
|
+
NSString *protocol = securityOrigin.protocol;
|
|
587
|
+
NSString *host = securityOrigin.host;
|
|
588
|
+
|
|
589
|
+
NSString *messageOriginURL = [NSString stringWithFormat:@"%@://%@", protocol, host];
|
|
590
|
+
|
|
585
591
|
NSMutableDictionary<NSString *, id> *event = [self baseEvent];
|
|
586
|
-
NSString *messageOriginURL = message.frameInfo.request.URL.absoluteString ?: @"";
|
|
587
592
|
event[@"url"] = messageOriginURL;
|
|
588
593
|
return event;
|
|
589
594
|
}
|
|
@@ -640,6 +645,16 @@ RCTAutoInsetsProtocol>
|
|
|
640
645
|
|
|
641
646
|
- (void)visitSource
|
|
642
647
|
{
|
|
648
|
+
// Check for a static html source first
|
|
649
|
+
NSString *html = [RCTConvert NSString:_source[@"html"]];
|
|
650
|
+
if (html) {
|
|
651
|
+
NSURL *baseURL = [RCTConvert NSURL:_source[@"baseUrl"]];
|
|
652
|
+
if (!baseURL) {
|
|
653
|
+
baseURL = [NSURL URLWithString:@"about:blank"];
|
|
654
|
+
}
|
|
655
|
+
[_webView loadHTMLString:html baseURL:baseURL];
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
643
658
|
// Add cookie for subsequent resource requests sent by page itself, if cookie was set in headers on WebView
|
|
644
659
|
NSString *headerCookie = [RCTConvert NSString:_source[@"headers"][@"cookie"]];
|
|
645
660
|
if(headerCookie) {
|
package/babel.config.js
ADDED
package/bin/setup
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#! /bin/bash
|
|
2
|
+
|
|
3
|
+
# Node installed?
|
|
4
|
+
if ! [ -x "$(command -v node)" ]; then
|
|
5
|
+
echo 'Error: node is not installed.' >&2
|
|
6
|
+
|
|
7
|
+
if ! [ -x "$(command -v brew)" ]; then
|
|
8
|
+
echo 'Go here to install: https://nodejs.org/en/download/'
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
if [ -x "$(command -v brew)" ]; then
|
|
12
|
+
echo 'You have Homebrew installed, so run "brew install node".'
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# React Native installed?
|
|
19
|
+
if ! [ -x "$(command -v react-native)" ]; then
|
|
20
|
+
echo 'Error: React Native is not installed.' >&2
|
|
21
|
+
echo 'Go here: https://reactnative.dev/docs/getting-started.html' >&2
|
|
22
|
+
echo 'Use the "Building Projects With Native Code" option.'
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# TODO: Automate setup on new machines
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Contributing to React Native WebView
|
|
2
|
+
|
|
3
|
+
First off, _thank you_ for considering contributing to the React Native Community. The community-supported packages are only possible because of amazing people like you.
|
|
4
|
+
|
|
5
|
+
Secondly, we'd like the contribution experience to be as good as possible. While we are a small all-volunteer team, we are happy to hear feedback about your experience, and if we can make the docs or experience better please let us know.
|
|
6
|
+
|
|
7
|
+
## How to test changes
|
|
8
|
+
|
|
9
|
+
After you fork the repo, clone it to your machine, and make your changes, you'll want to test them in an app.
|
|
10
|
+
|
|
11
|
+
There are two methods of testing:
|
|
12
|
+
1) Testing within a clone of react-native-webview
|
|
13
|
+
2) Testing in a new `react-native init` project
|
|
14
|
+
|
|
15
|
+
### Testing within react-native-webview
|
|
16
|
+
|
|
17
|
+
#### For all platforms:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
yarn install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
#### For Android:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
yarn android
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The Android example app will built, the Metro Bundler will launch, and the example app will be installed and started in the Android emulator.
|
|
30
|
+
|
|
31
|
+
#### For iOS:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pod install --project-directory=ios
|
|
35
|
+
yarn ios
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The iOS example app will be built, the Metro bundler will launch, and the example app will be installed and started in the Simulator.
|
|
39
|
+
|
|
40
|
+
#### For macOS:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
pod install --project-directory=macos
|
|
44
|
+
yarn macos
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The macOS example app will be built, the Metro bundler will launch, and the example app will be installed and started.
|
|
48
|
+
|
|
49
|
+
#### For Windows:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
yarn windows
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The Windows example app will be built, the Metro bundler will launch, and the example app will be installed and started.
|
|
56
|
+
|
|
57
|
+
### Testing in a new `react-native init` project
|
|
58
|
+
|
|
59
|
+
In a new `react-native init` project, do this:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
$ yarn add ../react-native-webview
|
|
63
|
+
$ react-native link react-native-webview
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
You may run into a problem where the `jest-haste-map` module map says react-native was added twice:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Loading dependency graph...(node:32651) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
|
|
70
|
+
Duplicate module name: react-native
|
|
71
|
+
Paths: /Users/myuser/TestApp/node_modules/react-native/package.json collides with /Users/myuser/TestApp/node_modules/react-native-webview/node_modules/react-native/package.json
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Just remove the second path like this:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
$ rm -rf ./node_modules/react-native-webview/node_modules/react-native
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
And then re-run the packager:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
$ react-native start --reset-cache
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
When you make a change, you'll probably need to unlink, remove, re-add, and re-link `react-native-webview`:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
$ react-native unlink react-native-webview && yarn remove react-native-webview
|
|
90
|
+
$ yarn add ../react-native-webview && react-native link react-native-webview
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Notes
|
|
94
|
+
|
|
95
|
+
- We use TypeScript.
|
|
96
|
+
- After pulling this repo and installing all dependencies, you can run tests using the command: `yarn ci`
|
|
97
|
+
|
|
98
|
+
## Translations
|
|
99
|
+
|
|
100
|
+
This file is available at:
|
|
101
|
+
|
|
102
|
+
- [Brazilian portuguese](Contributing.portuguese.md)
|