@exodus/react-native-webview 11.26.1-exodus.12 → 11.26.1-exodus.13
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/.prettierrc.js +10 -0
- package/.releaserc +15 -0
- package/.vscode/settings.json +9 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java +5 -6
- package/apple/RNCWebView.h +1 -0
- package/apple/RNCWebView.m +17 -10
- package/apple/RNCWebViewManager.m +1 -0
- 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 +2 -3
- package/lib/WebView.d.ts.map +1 -0
- package/lib/WebView.ios.d.ts.map +1 -0
- package/lib/WebView.ios.js +2 -3
- 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 +5 -0
- package/lib/WebViewTypes.d.ts.map +1 -0
- package/lib/index.d.ts.map +1 -0
- package/metro.config.js +57 -0
- package/package.json +1 -1
- package/src/WebView.android.tsx +246 -0
- package/src/WebView.ios.tsx +221 -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 +257 -0
- package/src/WebViewTypes.ts +920 -0
- package/src/__tests__/WebViewShared-test.js +208 -0
- package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +8 -0
- package/src/index.ts +4 -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-latest
|
|
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/.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
|
+
}
|
|
@@ -338,6 +338,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
|
|
338
338
|
CookieManager.getInstance().setAcceptThirdPartyCookies(view, enabled);
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
+
@ReactProp(name = "webviewDebuggingEnabled")
|
|
342
|
+
public void setWebviewDebuggingEnabled(WebView view, boolean value) {
|
|
343
|
+
((RNCWebView) view).setWebContentsDebuggingEnabled(value);
|
|
344
|
+
}
|
|
345
|
+
|
|
341
346
|
@ReactProp(name = "textZoom")
|
|
342
347
|
public void setTextZoom(WebView view, int value) {
|
|
343
348
|
view.getSettings().setTextZoom(value);
|
|
@@ -430,12 +435,6 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
|
|
430
435
|
@ReactProp(name = "source")
|
|
431
436
|
public void setSource(WebView view, @Nullable ReadableMap source) {
|
|
432
437
|
if (source != null) {
|
|
433
|
-
if (source.hasKey("html")) {
|
|
434
|
-
String html = source.getString("html");
|
|
435
|
-
String baseUrl = source.hasKey("baseUrl") ? source.getString("baseUrl") : "";
|
|
436
|
-
view.loadDataWithBaseURL(baseUrl, html, HTML_MIME_TYPE, HTML_ENCODING, null);
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
438
|
if (source.hasKey("uri")) {
|
|
440
439
|
String url = source.getString("uri");
|
|
441
440
|
String previousUrl = view.getUrl();
|
package/apple/RNCWebView.h
CHANGED
|
@@ -48,6 +48,7 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *_Nonnull)request
|
|
|
48
48
|
@property (nonatomic, assign) BOOL pagingEnabled;
|
|
49
49
|
@property (nonatomic, assign) CGFloat decelerationRate;
|
|
50
50
|
@property (nonatomic, assign) BOOL allowsInlineMediaPlayback;
|
|
51
|
+
@property (nonatomic, assign) BOOL webviewDebuggingEnabled;
|
|
51
52
|
@property (nonatomic, assign) BOOL bounces;
|
|
52
53
|
@property (nonatomic, assign) BOOL mediaPlaybackRequiresUserAction;
|
|
53
54
|
#if WEBKIT_IOS_10_APIS_AVAILABLE
|
package/apple/RNCWebView.m
CHANGED
|
@@ -406,6 +406,13 @@ RCTAutoInsetsProtocol>
|
|
|
406
406
|
}
|
|
407
407
|
#endif
|
|
408
408
|
|
|
409
|
+
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130300 || \
|
|
410
|
+
__IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 || \
|
|
411
|
+
__TV_OS_VERSION_MAX_ALLOWED >= 160400
|
|
412
|
+
if (@available(macOS 13.3, iOS 16.4, tvOS 16.4, *))
|
|
413
|
+
_webView.inspectable = _webviewDebuggingEnabled;
|
|
414
|
+
#endif
|
|
415
|
+
|
|
409
416
|
[self addSubview:_webView];
|
|
410
417
|
[self setHideKeyboardAccessoryView: _savedHideKeyboardAccessoryView];
|
|
411
418
|
[self setKeyboardDisplayRequiresUserAction: _savedKeyboardDisplayRequiresUserAction];
|
|
@@ -431,6 +438,16 @@ RCTAutoInsetsProtocol>
|
|
|
431
438
|
_webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
|
|
432
439
|
}
|
|
433
440
|
|
|
441
|
+
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130300 || \
|
|
442
|
+
__IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 || \
|
|
443
|
+
__TV_OS_VERSION_MAX_ALLOWED >= 160400
|
|
444
|
+
- (void)setWebviewDebuggingEnabled:(BOOL)webviewDebuggingEnabled {
|
|
445
|
+
_webviewDebuggingEnabled = webviewDebuggingEnabled;
|
|
446
|
+
if (@available(macOS 13.3, iOS 16.4, tvOS 16.4, *))
|
|
447
|
+
_webView.inspectable = _webviewDebuggingEnabled;
|
|
448
|
+
}
|
|
449
|
+
#endif
|
|
450
|
+
|
|
434
451
|
- (void)removeFromSuperview
|
|
435
452
|
{
|
|
436
453
|
if (_webView) {
|
|
@@ -615,16 +632,6 @@ RCTAutoInsetsProtocol>
|
|
|
615
632
|
|
|
616
633
|
- (void)visitSource
|
|
617
634
|
{
|
|
618
|
-
// Check for a static html source first
|
|
619
|
-
NSString *html = [RCTConvert NSString:_source[@"html"]];
|
|
620
|
-
if (html) {
|
|
621
|
-
NSURL *baseURL = [RCTConvert NSURL:_source[@"baseUrl"]];
|
|
622
|
-
if (!baseURL) {
|
|
623
|
-
baseURL = [NSURL URLWithString:@"about:blank"];
|
|
624
|
-
}
|
|
625
|
-
[_webView loadHTMLString:html baseURL:baseURL];
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
635
|
// Add cookie for subsequent resource requests sent by page itself, if cookie was set in headers on WebView
|
|
629
636
|
NSString *headerCookie = [RCTConvert NSString:_source[@"headers"][@"cookie"]];
|
|
630
637
|
if(headerCookie) {
|
|
@@ -63,6 +63,7 @@ RCT_EXPORT_VIEW_PROPERTY(injectedJavaScript, NSString)
|
|
|
63
63
|
RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptBeforeContentLoaded, NSString)
|
|
64
64
|
RCT_EXPORT_VIEW_PROPERTY(javaScriptEnabled, BOOL)
|
|
65
65
|
RCT_EXPORT_VIEW_PROPERTY(allowsInlineMediaPlayback, BOOL)
|
|
66
|
+
RCT_EXPORT_VIEW_PROPERTY(webviewDebuggingEnabled, BOOL)
|
|
66
67
|
RCT_EXPORT_VIEW_PROPERTY(mediaPlaybackRequiresUserAction, BOOL)
|
|
67
68
|
#if WEBKIT_IOS_10_APIS_AVAILABLE
|
|
68
69
|
RCT_EXPORT_VIEW_PROPERTY(dataDetectorTypes, WKDataDetectorTypes)
|
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)
|