Procházet zdrojové kódy

Merge remote-tracking branch 'rn_webview/master'

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
sunzhongliang před 4 roky
rodič
revize
0cbeaba18f
100 změnil soubory, kde provedl 4077 přidání a 3614 odebrání
  1. 1
    1
      .circleci/config.yml
  2. 12
    0
      .gitattributes
  3. 1
    1
      .github/workflows/detox.yml
  4. 108
    0
      .github/workflows/scripts/install-vs-features.ps1
  5. 61
    0
      .github/workflows/windows-ci.yml
  6. 2
    0
      .gitignore
  7. 1
    1
      README.md
  8. 31
    0
      __tests__/Alert.test.js
  9. 23
    14
      android/build.gradle
  10. 2
    2
      android/gradle.properties
  11. 309
    32
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
  12. 196
    71
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java
  13. 26
    0
      android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt
  14. 2
    0
      android/src/main/java/com/reactnativecommunity/webview/events/TopShouldStartLoadWithRequestEvent.kt
  15. 0
    0
      apple/RNCWKProcessPoolManager.h
  16. 0
    0
      apple/RNCWKProcessPoolManager.m
  17. 10
    0
      apple/RNCWebView.h
  18. 135
    52
      apple/RNCWebView.m
  19. 0
    0
      apple/RNCWebViewManager.h
  20. 20
    0
      apple/RNCWebViewManager.m
  21. 1
    1
      docs/Custom-Android.md
  22. 3
    1
      docs/Debugging.md
  23. 5
    11
      docs/Getting-Started.md
  24. 47
    15
      docs/Guide.md
  25. 5
    1
      docs/README.portuguese.md
  26. 226
    81
      docs/Reference.md
  27. 28
    0
      example/App.tsx
  28. 7
    0
      example/android/app/src/main/java/com/example/MainApplication.java
  29. 4
    4
      example/android/build.gradle
  30. 1
    1
      example/android/gradle/wrapper/gradle-wrapper.properties
  31. 2
    2
      example/android/gradlew
  32. 100
    100
      example/android/gradlew.bat
  33. 9
    0
      example/assets/test.html
  34. 55
    0
      example/examples/Downloads.tsx
  35. 28
    27
      example/examples/Injection.tsx
  36. 16
    0
      example/examples/LocalPageLoad.tsx
  37. 6
    6
      example/ios/Podfile
  38. 181
    157
      example/ios/Podfile.lock
  39. 11
    7
      example/ios/example.xcodeproj/project.pbxproj
  40. 2
    43
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme
  41. 2
    43
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme
  42. 42
    0
      example/macos/Podfile
  43. 199
    0
      example/macos/Podfile.lock
  44. 0
    7
      example/macos/example-iOS/AppDelegate.h
  45. 0
    7
      example/macos/example-iOS/AppDelegate.m
  46. 0
    0
      example/macos/example-iOS/Base.lproj/LaunchScreen.xib
  47. 0
    15
      example/macos/example-iOS/Images.xcassets/AppIcon.appiconset/Contents.json
  48. 0
    0
      example/macos/example-iOS/Images.xcassets/Contents.json
  49. 1
    1
      example/macos/example-iOS/Info.plist
  50. 0
    7
      example/macos/example-iOS/main.m
  51. 0
    7
      example/macos/example-macOS/AppDelegate.h
  52. 0
    7
      example/macos/example-macOS/AppDelegate.m
  53. 58
    0
      example/macos/example-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json
  54. 6
    0
      example/macos/example-macOS/Assets.xcassets/Contents.json
  55. 25
    21
      example/macos/example-macOS/Base.lproj/Main.storyboard
  56. 17
    15
      example/macos/example-macOS/Info.plist
  57. 0
    7
      example/macos/example-macOS/ViewController.h
  58. 0
    7
      example/macos/example-macOS/ViewController.m
  59. 12
    0
      example/macos/example-macOS/example.entitlements
  60. 0
    7
      example/macos/example-macOS/main.m
  61. 606
    1569
      example/macos/example.xcodeproj/project.pbxproj
  62. 5
    19
      example/macos/example.xcodeproj/xcshareddata/xcschemes/example-iOS.xcscheme
  63. 8
    22
      example/macos/example.xcodeproj/xcshareddata/xcschemes/example-macOS.xcscheme
  64. 10
    0
      example/macos/example.xcworkspace/contents.xcworkspacedata
  65. 2
    4
      example/macos/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  66. 1
    0
      example/windows/.gitignore
  67. 1
    0
      example/windows/WebViewWindows.sln
  68. 0
    5
      example/windows/WebViewWindows/App.cpp
  69. 1
    1
      example/windows/WebViewWindows/Package.appxmanifest
  70. 5
    4
      example/windows/WebViewWindows/WebViewWindows.vcxproj
  71. 1
    0
      example/windows/WebViewWindows/WebViewWindows.vcxproj.filters
  72. 24
    24
      example/windows/WebViewWindows/pch.h
  73. 1
    1
      index.d.ts
  74. 7
    7
      ios/RNCWebView.xcodeproj/project.pbxproj
  75. 12
    0
      jest-setups/jest.setup.js
  76. 1
    0
      jest-setups/jest.setup.windows.js
  77. 24
    24
      macos/RNCWebView.xcodeproj/project.pbxproj
  78. 2
    0
      metro.config.windows.js
  79. 90
    86
      package.json
  80. 2
    2
      react-native-webview.podspec
  81. 14
    0
      react-native.config.js
  82. 28
    5
      src/WebView.android.tsx
  83. 1
    0
      src/WebView.ios.tsx
  84. 18
    3
      src/WebView.tsx
  85. 266
    258
      src/WebView.windows.tsx
  86. 2
    2
      src/WebViewShared.tsx
  87. 115
    10
      src/WebViewTypes.ts
  88. 204
    204
      windows/ReactNativeWebView.sln
  89. 15
    15
      windows/ReactNativeWebView/PropertySheet.props
  90. 3
    3
      windows/ReactNativeWebView/ReactNativeWebView.def
  91. 32
    32
      windows/ReactNativeWebView/ReactNativeWebView.filters
  92. 159
    161
      windows/ReactNativeWebView/ReactNativeWebView.vcxproj
  93. 17
    17
      windows/ReactNativeWebView/ReactPackageProvider.cpp
  94. 20
    20
      windows/ReactNativeWebView/ReactPackageProvider.h
  95. 7
    7
      windows/ReactNativeWebView/ReactPackageProvider.idl
  96. 147
    143
      windows/ReactNativeWebView/ReactWebView.cpp
  97. 36
    35
      windows/ReactNativeWebView/ReactWebView.h
  98. 7
    6
      windows/ReactNativeWebView/ReactWebView.idl
  99. 144
    143
      windows/ReactNativeWebView/ReactWebViewManager.cpp
  100. 0
    0
      windows/ReactNativeWebView/ReactWebViewManager.h

+ 1
- 1
.circleci/config.yml Zobrazit soubor

@@ -34,7 +34,7 @@ jobs:
34 34
             - node_modules-{{ arch }}-{{ checksum "yarn.lock" }}
35 35
 
36 36
       - run:
37
-          name: Run Tests
37
+          name: Lint checks
38 38
           command: yarn ci
39 39
 
40 40
   publish:

+ 12
- 0
.gitattributes Zobrazit soubor

@@ -0,0 +1,12 @@
1
+* text=auto
2
+
3
+*.bat text eol=crlf
4
+*.def text eol=crlf
5
+*.filters text eol=crlf
6
+*.idl text eol=crlf
7
+*.props text eol=crlf
8
+*.ps1 text eol=crlf 
9
+*.sln text eol=crlf
10
+*.vcxproj text eol=crlf
11
+*.xaml text eol=crlf
12
+

+ 1
- 1
.github/workflows/detox.yml Zobrazit soubor

@@ -1,5 +1,5 @@
1 1
 name: 'Detox CI Tests'
2
-on: [push]
2
+on: [pull_request]
3 3
 
4 4
 jobs:
5 5
   tests:

+ 108
- 0
.github/workflows/scripts/install-vs-features.ps1 Zobrazit soubor

@@ -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
+}

+ 61
- 0
.github/workflows/windows-ci.yml Zobrazit soubor

@@ -0,0 +1,61 @@
1
+name: Windows CI
2
+on: [pull_request]
3
+
4
+jobs:
5
+  run-windows-tests:
6
+    name: Build & run tests
7
+    runs-on: windows-2019
8
+
9
+    steps:
10
+    - uses: actions/checkout@v2
11
+      name: Checkout Code
12
+     
13
+    - name: Setup Node.js
14
+      uses: actions/setup-node@v1
15
+      with:
16
+        node-version: '12.9.1'
17
+
18
+    - name: Setup MSBuild
19
+      uses: microsoft/setup-msbuild@v1.0.0
20
+      with:
21
+        vs-version: 16.5
22
+
23
+    - name: Check node modules cache
24
+      uses: actions/cache@v1
25
+      id: yarn-cache
26
+      with:
27
+        path: ./node_modules
28
+        key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
29
+        restore-keys: |
30
+          ${{ runner.os }}-yarn-
31
+
32
+    - name: Install node modules
33
+      if: steps.yarn-cache.outputs.cache-hit != 'true'
34
+      run: yarn --pure-lockfile
35
+    
36
+    - name: yarn build
37
+      if: steps.yarn-cache.outputs.cache-hit == 'true'
38
+      run: |
39
+        yarn build
40
+        yarn tsc
41
+
42
+    - name: Build x64 release
43
+      shell: powershell
44
+      run: npx react-native run-windows --root example --arch x64 --release --no-packager --no-deploy --logging
45
+
46
+    # Workaround for a bug in package searching during deploy.
47
+    # The deploy script only searches windows/{*/bin/x64/Release,Release/*}, but the build step above placed the pakcages at windows/x64/Release.
48
+    # Copy the packages to Windows/Release before deploying.
49
+    - name: Deploy
50
+      shell: powershell
51
+      run: |
52
+        cd example
53
+        Copy-Item -Path windows\x64\Release -Recurse -Destination windows\
54
+        npx react-native run-windows --arch x64 --release --no-build --no-packager
55
+
56
+    - name: Start Appium server
57
+      shell: powershell
58
+      run: Start-Process PowerShell -ArgumentList "yarn appium"
59
+      
60
+    - name: Run tests
61
+      run: yarn test:windows

+ 2
- 0
.gitignore Zobrazit soubor

@@ -57,3 +57,5 @@ lib/
57 57
 .classpath
58 58
 .project
59 59
 .settings/
60
+msbuild.binlog
61
+example/msbuild.binlog

+ 1
- 1
README.md Zobrazit soubor

@@ -97,7 +97,7 @@ This project follows the [all-contributors](https://github.com/all-contributors/
97 97
 
98 98
 MIT
99 99
 
100
-## Traduções
100
+## Translations
101 101
 
102 102
 This readme is available in:
103 103
 

+ 31
- 0
__tests__/Alert.test.js Zobrazit soubor

@@ -0,0 +1,31 @@
1
+/**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+import { driver, By2 } from 'selenium-appium'
7
+import { until } from 'selenium-webdriver';
8
+
9
+const setup = require('../jest-setups/jest.setup');
10
+jest.setTimeout(50000);
11
+
12
+beforeAll(() => {
13
+  return driver.startWithCapabilities(setup.capabilites);
14
+});
15
+
16
+afterAll(() => {
17
+  return driver.quit();
18
+});
19
+
20
+describe('Alert Tests', () => {
21
+  
22
+  test('Show Alert', async () => {
23
+    const showAlertButton = await driver.wait(until.elementLocated(By2.nativeName('Show alert')));
24
+    await showAlertButton.click();
25
+    await driver.wait(until.elementLocated(By2.nativeName('Hello! I am an alert box!')));
26
+    await By2.nativeName('OK').click();
27
+    const dismissMessage = await driver.wait(until.elementLocated(By2.nativeName('Alert dismissed!')));
28
+    expect(dismissMessage).not.toBeNull();
29
+  });
30
+
31
+});

+ 23
- 14
android/build.gradle Zobrazit soubor

@@ -1,21 +1,30 @@
1 1
 buildscript {
2
-  //Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
-  def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['ReactNativeWebView_kotlinVersion']
4
-
5
-  repositories {
6
-    google()
7
-    jcenter()
2
+  ext.getExtOrDefault = {name ->
3
+    return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeWebView_' + name]
8 4
   }
9 5
 
10
-  dependencies {
11
-    classpath 'com.android.tools.build:gradle:3.2.1'
12
-    //noinspection DifferentKotlinGradleVersion
13
-    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
-  }
15
-}
6
+  // The Android Gradle plugin is only required when opening the android folder stand-alone.
7
+  // This avoids unnecessary downloads and potential conflicts when the library is included as a
8
+  // module dependency in an application project.
9
+  if (project == rootProject) {
10
+    repositories {
11
+      google()
12
+      jcenter()
13
+    }
14
+
15
+    dependencies {
16
+      classpath("com.android.tools.build:gradle:3.6.0")
17
+      classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
18
+    }
19
+  } else {
20
+    repositories {
21
+      jcenter()
22
+    }
16 23
 
17
-def getExtOrDefault(name) {
18
-  return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeWebView_' + name]
24
+    dependencies {
25
+      classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
26
+    }
27
+  }
19 28
 }
20 29
 
21 30
 def getExtOrIntegerDefault(name) {

+ 2
- 2
android/gradle.properties Zobrazit soubor

@@ -1,4 +1,4 @@
1 1
 ReactNativeWebView_kotlinVersion=1.3.50
2
-ReactNativeWebView_compileSdkVersion=28
3
-ReactNativeWebView_buildToolsVersion=28.0.3
2
+ReactNativeWebView_compileSdkVersion=29
3
+ReactNativeWebView_buildToolsVersion=29.0.3
4 4
 ReactNativeWebView_targetSdkVersion=28

+ 309
- 32
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java Zobrazit soubor

@@ -4,18 +4,18 @@ import android.annotation.SuppressLint;
4 4
 import android.annotation.TargetApi;
5 5
 import android.app.DownloadManager;
6 6
 import android.content.Context;
7
-import android.content.Intent;
8 7
 import android.content.pm.ActivityInfo;
9 8
 import android.content.pm.PackageManager;
10 9
 import android.graphics.Bitmap;
11 10
 import android.graphics.Color;
12 11
 import android.Manifest;
12
+import android.net.http.SslError;
13 13
 import android.net.Uri;
14 14
 import android.os.Build;
15 15
 import android.os.Environment;
16
-import androidx.annotation.RequiresApi;
17
-import androidx.core.content.ContextCompat;
16
+import android.os.SystemClock;
18 17
 import android.text.TextUtils;
18
+import android.util.Log;
19 19
 import android.view.Gravity;
20 20
 import android.view.View;
21 21
 import android.view.ViewGroup;
@@ -26,6 +26,8 @@ import android.webkit.CookieManager;
26 26
 import android.webkit.DownloadListener;
27 27
 import android.webkit.GeolocationPermissions;
28 28
 import android.webkit.JavascriptInterface;
29
+import android.webkit.RenderProcessGoneDetail;
30
+import android.webkit.SslErrorHandler;
29 31
 import android.webkit.PermissionRequest;
30 32
 import android.webkit.URLUtil;
31 33
 import android.webkit.ValueCallback;
@@ -37,6 +39,12 @@ import android.webkit.WebView;
37 39
 import android.webkit.WebViewClient;
38 40
 import android.widget.FrameLayout;
39 41
 
42
+import androidx.annotation.Nullable;
43
+import androidx.annotation.RequiresApi;
44
+import androidx.core.content.ContextCompat;
45
+import androidx.core.util.Pair;
46
+
47
+import com.facebook.common.logging.FLog;
40 48
 import com.facebook.react.views.scroll.ScrollEvent;
41 49
 import com.facebook.react.views.scroll.ScrollEventType;
42 50
 import com.facebook.react.views.scroll.OnScrollDispatchHelper;
@@ -60,6 +68,7 @@ import com.facebook.react.uimanager.annotations.ReactProp;
60 68
 import com.facebook.react.uimanager.events.ContentSizeChangeEvent;
61 69
 import com.facebook.react.uimanager.events.Event;
62 70
 import com.facebook.react.uimanager.events.EventDispatcher;
71
+import com.reactnativecommunity.webview.RNCWebViewModule.ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState;
63 72
 import com.reactnativecommunity.webview.events.TopLoadingErrorEvent;
64 73
 import com.reactnativecommunity.webview.events.TopHttpErrorEvent;
65 74
 import com.reactnativecommunity.webview.events.TopLoadingFinishEvent;
@@ -67,6 +76,7 @@ import com.reactnativecommunity.webview.events.TopLoadingProgressEvent;
67 76
 import com.reactnativecommunity.webview.events.TopLoadingStartEvent;
68 77
 import com.reactnativecommunity.webview.events.TopMessageEvent;
69 78
 import com.reactnativecommunity.webview.events.TopShouldStartLoadWithRequestEvent;
79
+import com.reactnativecommunity.webview.events.TopRenderProcessGoneEvent;
70 80
 
71 81
 import org.json.JSONException;
72 82
 import org.json.JSONObject;
@@ -79,8 +89,7 @@ import java.util.ArrayList;
79 89
 import java.util.HashMap;
80 90
 import java.util.Locale;
81 91
 import java.util.Map;
82
-
83
-import javax.annotation.Nullable;
92
+import java.util.concurrent.atomic.AtomicReference;
84 93
 
85 94
 /**
86 95
  * Manages instances of {@link WebView}
@@ -108,8 +117,8 @@ import javax.annotation.Nullable;
108 117
  */
109 118
 @ReactModule(name = RNCWebViewManager.REACT_CLASS)
110 119
 public class RNCWebViewManager extends SimpleViewManager<WebView> {
120
+  private static final String TAG = "RNCWebViewManager";
111 121
 
112
-  public static String activeUrl = null;
113 122
   public static final int COMMAND_GO_BACK = 1;
114 123
   public static final int COMMAND_GO_FORWARD = 2;
115 124
   public static final int COMMAND_RELOAD = 3;
@@ -132,6 +141,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
132 141
   // Use `webView.loadUrl("about:blank")` to reliably reset the view
133 142
   // state and release page resources (including any running JavaScript).
134 143
   protected static final String BLANK_URL = "about:blank";
144
+  protected static final int SHOULD_OVERRIDE_URL_LOADING_TIMEOUT = 250;
135 145
   protected WebViewConfig mWebViewConfig;
136 146
 
137 147
   protected RNCWebChromeClient mWebChromeClient = null;
@@ -197,6 +207,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
197 207
 
198 208
     webView.setDownloadListener(new DownloadListener() {
199 209
       public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
210
+        webView.setIgnoreErrFailedForThisURL(url);
211
+
200 212
         RNCWebViewModule module = getModule(reactContext);
201 213
 
202 214
         DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
@@ -293,6 +305,21 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
293 305
     }
294 306
   }
295 307
 
308
+  @ReactProp(name = "androidLayerType")
309
+  public void setLayerType(WebView view, String layerTypeString) {
310
+    int layerType = View.LAYER_TYPE_NONE;
311
+    switch (layerTypeString) {
312
+        case "hardware":
313
+          layerType = View.LAYER_TYPE_HARDWARE;
314
+          break;
315
+        case "software":
316
+          layerType = View.LAYER_TYPE_SOFTWARE;
317
+          break;
318
+    }
319
+    view.setLayerType(layerType, null);
320
+  }
321
+
322
+
296 323
   @ReactProp(name = "overScrollMode")
297 324
   public void setOverScrollMode(WebView view, String overScrollModeString) {
298 325
     Integer overScrollMode;
@@ -374,6 +401,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
374 401
     view.getSettings().setMediaPlaybackRequiresUserGesture(requires);
375 402
   }
376 403
 
404
+  @ReactProp(name = "javaScriptCanOpenWindowsAutomatically")
405
+  public void setJavaScriptCanOpenWindowsAutomatically(WebView view, boolean enabled) {
406
+    view.getSettings().setJavaScriptCanOpenWindowsAutomatically(enabled);
407
+  }
408
+
377 409
   @ReactProp(name = "allowFileAccessFromFileURLs")
378 410
   public void setAllowFileAccessFromFileURLs(WebView view, boolean allow) {
379 411
     view.getSettings().setAllowFileAccessFromFileURLs(allow);
@@ -394,13 +426,38 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
394 426
     ((RNCWebView) view).setInjectedJavaScript(injectedJavaScript);
395 427
   }
396 428
 
429
+  @ReactProp(name = "injectedJavaScriptBeforeContentLoaded")
430
+  public void setInjectedJavaScriptBeforeContentLoaded(WebView view, @Nullable String injectedJavaScriptBeforeContentLoaded) {
431
+    ((RNCWebView) view).setInjectedJavaScriptBeforeContentLoaded(injectedJavaScriptBeforeContentLoaded);
432
+  }
433
+
434
+  @ReactProp(name = "injectedJavaScriptForMainFrameOnly")
435
+  public void setInjectedJavaScriptForMainFrameOnly(WebView view, boolean enabled) {
436
+    ((RNCWebView) view).setInjectedJavaScriptForMainFrameOnly(enabled);
437
+  }
438
+
439
+  @ReactProp(name = "injectedJavaScriptBeforeContentLoadedForMainFrameOnly")
440
+  public void setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(WebView view, boolean enabled) {
441
+    ((RNCWebView) view).setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(enabled);
442
+  }
443
+
397 444
   @ReactProp(name = "messagingEnabled")
398 445
   public void setMessagingEnabled(WebView view, boolean enabled) {
399 446
     ((RNCWebView) view).setMessagingEnabled(enabled);
400 447
   }
401
-   
448
+
449
+  @ReactProp(name = "messagingModuleName")
450
+  public void setMessagingModuleName(WebView view, String moduleName) {
451
+    ((RNCWebView) view).setMessagingModuleName(moduleName);
452
+  }
453
+
402 454
   @ReactProp(name = "incognito")
403 455
   public void setIncognito(WebView view, boolean enabled) {
456
+    // Don't do anything when incognito is disabled
457
+    if (!enabled) {
458
+      return;
459
+    }
460
+
404 461
     // Remove all previous cookies
405 462
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
406 463
       CookieManager.getInstance().removeAllCookies(null);
@@ -410,14 +467,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
410 467
 
411 468
     // Disable caching
412 469
     view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
413
-    view.getSettings().setAppCacheEnabled(!enabled);
470
+    view.getSettings().setAppCacheEnabled(false);
414 471
     view.clearHistory();
415
-    view.clearCache(enabled);
472
+    view.clearCache(true);
416 473
 
417 474
     // No form data or autofill enabled
418 475
     view.clearFormData();
419
-    view.getSettings().setSavePassword(!enabled);
420
-    view.getSettings().setSaveFormData(!enabled);
476
+    view.getSettings().setSavePassword(false);
477
+    view.getSettings().setSaveFormData(false);
421 478
   }
422 479
 
423 480
   @ReactProp(name = "source")
@@ -547,6 +604,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
547 604
     export.put(TopShouldStartLoadWithRequestEvent.EVENT_NAME, MapBuilder.of("registrationName", "onShouldStartLoadWithRequest"));
548 605
     export.put(ScrollEventType.getJSEventName(ScrollEventType.SCROLL), MapBuilder.of("registrationName", "onScroll"));
549 606
     export.put(TopHttpErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onHttpError"));
607
+    export.put(TopRenderProcessGoneEvent.EVENT_NAME, MapBuilder.of("registrationName", "onRenderProcessGone"));
550 608
     return export;
551 609
   }
552 610
 
@@ -611,6 +669,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
611 669
         if (args == null) {
612 670
           throw new RuntimeException("Arguments for loading an url are null!");
613 671
         }
672
+        ((RNCWebView) root).progressChangedFilter.setWaitingForCommandLoadUrl(false);
614 673
         root.loadUrl(args.getString(0));
615 674
         break;
616 675
       case COMMAND_FOCUS:
@@ -648,7 +707,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
648 707
         public Bitmap getDefaultVideoPoster() {
649 708
           return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
650 709
         }
651
-        
710
+
652 711
         @Override
653 712
         public void onShowCustomView(View view, CustomViewCallback callback) {
654 713
           if (mVideoView != null) {
@@ -716,6 +775,12 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
716 775
     protected boolean mLastLoadFailed = false;
717 776
     protected @Nullable
718 777
     ReadableArray mUrlPrefixesForDefaultIntent;
778
+    protected RNCWebView.ProgressChangedFilter progressChangedFilter = null;
779
+    protected @Nullable String ignoreErrFailedForThisURL = null;
780
+
781
+    public void setIgnoreErrFailedForThisURL(@Nullable String url) {
782
+      ignoreErrFailedForThisURL = url;
783
+    }
719 784
 
720 785
     @Override
721 786
     public void onPageFinished(WebView webView, String url) {
@@ -735,6 +800,9 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
735 800
       super.onPageStarted(webView, url, favicon);
736 801
       mLastLoadFailed = false;
737 802
 
803
+      RNCWebView reactWebView = (RNCWebView) webView;
804
+      reactWebView.callInjectedJavaScriptBeforeContentLoaded();
805
+
738 806
       dispatchEvent(
739 807
         webView,
740 808
         new TopLoadingStartEvent(
@@ -744,15 +812,52 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
744 812
 
745 813
     @Override
746 814
     public boolean shouldOverrideUrlLoading(WebView view, String url) {
747
-      activeUrl = url;
748
-      dispatchEvent(
749
-        view,
750
-        new TopShouldStartLoadWithRequestEvent(
751
-          view.getId(),
752
-          createWebViewEvent(view, url)));
753
-      return true;
754
-    }
815
+      final RNCWebView rncWebView = (RNCWebView) view;
816
+      final boolean isJsDebugging = ((ReactContext) view.getContext()).getJavaScriptContextHolder().get() == 0;
817
+
818
+      if (!isJsDebugging && rncWebView.mCatalystInstance != null) {
819
+        final Pair<Integer, AtomicReference<ShouldOverrideCallbackState>> lock = RNCWebViewModule.shouldOverrideUrlLoadingLock.getNewLock();
820
+        final int lockIdentifier = lock.first;
821
+        final AtomicReference<ShouldOverrideCallbackState> lockObject = lock.second;
822
+
823
+        final WritableMap event = createWebViewEvent(view, url);
824
+        event.putInt("lockIdentifier", lockIdentifier);
825
+        rncWebView.sendDirectMessage("onShouldStartLoadWithRequest", event);
826
+
827
+        try {
828
+          assert lockObject != null;
829
+          synchronized (lockObject) {
830
+            final long startTime = SystemClock.elapsedRealtime();
831
+            while (lockObject.get() == ShouldOverrideCallbackState.UNDECIDED) {
832
+              if (SystemClock.elapsedRealtime() - startTime > SHOULD_OVERRIDE_URL_LOADING_TIMEOUT) {
833
+                FLog.w(TAG, "Did not receive response to shouldOverrideUrlLoading in time, defaulting to allow loading.");
834
+                RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);
835
+                return false;
836
+              }
837
+              lockObject.wait(SHOULD_OVERRIDE_URL_LOADING_TIMEOUT);
838
+            }
839
+          }
840
+        } catch (InterruptedException e) {
841
+          FLog.e(TAG, "shouldOverrideUrlLoading was interrupted while waiting for result.", e);
842
+          RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);
843
+          return false;
844
+        }
755 845
 
846
+        final boolean shouldOverride = lockObject.get() == ShouldOverrideCallbackState.SHOULD_OVERRIDE;
847
+        RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);
848
+
849
+        return shouldOverride;
850
+      } else {
851
+        FLog.w(TAG, "Couldn't use blocking synchronous call for onShouldStartLoadWithRequest due to debugging or missing Catalyst instance, falling back to old event-and-load.");
852
+        progressChangedFilter.setWaitingForCommandLoadUrl(true);
853
+        dispatchEvent(
854
+          view,
855
+          new TopShouldStartLoadWithRequestEvent(
856
+            view.getId(),
857
+            createWebViewEvent(view, url)));
858
+        return true;
859
+      }
860
+    }
756 861
 
757 862
     @TargetApi(Build.VERSION_CODES.N)
758 863
     @Override
@@ -761,12 +866,71 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
761 866
       return this.shouldOverrideUrlLoading(view, url);
762 867
     }
763 868
 
869
+    @Override
870
+    public void onReceivedSslError(final WebView webView, final SslErrorHandler handler, final SslError error) {
871
+        handler.cancel();
872
+
873
+        int code = error.getPrimaryError();
874
+        String failingUrl = error.getUrl();
875
+        String description = "";
876
+        String descriptionPrefix = "SSL error: ";
877
+
878
+        // https://developer.android.com/reference/android/net/http/SslError.html
879
+        switch (code) {
880
+          case SslError.SSL_DATE_INVALID:
881
+            description = "The date of the certificate is invalid";
882
+            break;
883
+          case SslError.SSL_EXPIRED:
884
+            description = "The certificate has expired";
885
+            break;
886
+          case SslError.SSL_IDMISMATCH:
887
+            description = "Hostname mismatch";
888
+            break;
889
+          case SslError.SSL_INVALID:
890
+            description = "A generic error occurred";
891
+            break;
892
+          case SslError.SSL_NOTYETVALID:
893
+            description = "The certificate is not yet valid";
894
+            break;
895
+          case SslError.SSL_UNTRUSTED:
896
+            description = "The certificate authority is not trusted";
897
+            break;
898
+          default:
899
+            description = "Unknown SSL Error";
900
+            break;
901
+        }
902
+
903
+        description = descriptionPrefix + description;
904
+
905
+        this.onReceivedError(
906
+          webView,
907
+          code,
908
+          description,
909
+          failingUrl
910
+        );
911
+    }
912
+
764 913
     @Override
765 914
     public void onReceivedError(
766 915
       WebView webView,
767 916
       int errorCode,
768 917
       String description,
769 918
       String failingUrl) {
919
+
920
+      if (ignoreErrFailedForThisURL != null
921
+          && failingUrl.equals(ignoreErrFailedForThisURL)
922
+          && errorCode == -1
923
+          && description.equals("net::ERR_FAILED")) {
924
+
925
+        // This is a workaround for a bug in the WebView.
926
+        // See these chromium issues for more context:
927
+        // https://bugs.chromium.org/p/chromium/issues/detail?id=1023678
928
+        // https://bugs.chromium.org/p/chromium/issues/detail?id=1050635
929
+        // This entire commit should be reverted once this bug is resolved in chromium.
930
+        setIgnoreErrFailedForThisURL(null);
931
+        return;
932
+      }
933
+
770 934
       super.onReceivedError(webView, errorCode, description, failingUrl);
771 935
       mLastLoadFailed = true;
772 936
 
@@ -802,6 +966,41 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
802 966
       }
803 967
     }
804 968
 
969
+    @TargetApi(Build.VERSION_CODES.O)
970
+    @Override
971
+    public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail detail) {
972
+        // WebViewClient.onRenderProcessGone was added in O.
973
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
974
+            return false;
975
+        }
976
+        super.onRenderProcessGone(webView, detail);
977
+
978
+        if(detail.didCrash()){
979
+          Log.e("RNCWebViewManager", "The WebView rendering process crashed.");
980
+        }
981
+        else{
982
+          Log.w("RNCWebViewManager", "The WebView rendering process was killed by the system.");
983
+        }
984
+
985
+        // if webView is null, we cannot return any event
986
+        // since the view is already dead/disposed
987
+        // still prevent the app crash by returning true.
988
+        if(webView == null){
989
+          return true;
990
+        }
991
+
992
+        WritableMap event = createWebViewEvent(webView, webView.getUrl());
993
+        event.putBoolean("didCrash", detail.didCrash());
994
+
995
+        dispatchEvent(
996
+          webView,
997
+          new TopRenderProcessGoneEvent(webView.getId(), event)
998
+        );
999
+
1000
+        // returning false would crash the app.
1001
+        return true;
1002
+    }
1003
+
805 1004
     protected void emitFinishEvent(WebView webView, String url) {
806 1005
       dispatchEvent(
807 1006
         webView,
@@ -826,6 +1025,10 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
826 1025
     public void setUrlPrefixesForDefaultIntent(ReadableArray specialUrls) {
827 1026
       mUrlPrefixesForDefaultIntent = specialUrls;
828 1027
     }
1028
+
1029
+    public void setProgressChangedFilter(RNCWebView.ProgressChangedFilter filter) {
1030
+      progressChangedFilter = filter;
1031
+    }
829 1032
   }
830 1033
 
831 1034
   protected static class RNCWebChromeClient extends WebChromeClient implements LifecycleEventListener {
@@ -847,6 +1050,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
847 1050
     protected View mVideoView;
848 1051
     protected WebChromeClient.CustomViewCallback mCustomViewCallback;
849 1052
 
1053
+    protected RNCWebView.ProgressChangedFilter progressChangedFilter = null;
1054
+
850 1055
     public RNCWebChromeClient(ReactContext reactContext, WebView webView) {
851 1056
       this.mReactContext = reactContext;
852 1057
       this.mWebView = webView;
@@ -901,11 +1106,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
901 1106
     public void onProgressChanged(WebView webView, int newProgress) {
902 1107
       super.onProgressChanged(webView, newProgress);
903 1108
       final String url = webView.getUrl();
904
-      if (
905
-        url != null
906
-        && activeUrl != null
907
-        && !url.equals(activeUrl)
908
-      ) {
1109
+      if (progressChangedFilter.isWaitingForCommandLoadUrl()) {
909 1110
         return;
910 1111
       }
911 1112
       WritableMap event = Arguments.createMap();
@@ -944,8 +1145,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
944 1145
     public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
945 1146
       String[] acceptTypes = fileChooserParams.getAcceptTypes();
946 1147
       boolean allowMultiple = fileChooserParams.getMode() == WebChromeClient.FileChooserParams.MODE_OPEN_MULTIPLE;
947
-      Intent intent = fileChooserParams.createIntent();
948
-      return getModule(mReactContext).startPhotoPickerIntent(filePathCallback, intent, acceptTypes, allowMultiple);
1148
+      return getModule(mReactContext).startPhotoPickerIntent(filePathCallback, acceptTypes, allowMultiple);
949 1149
     }
950 1150
 
951 1151
     @Override
@@ -964,6 +1164,10 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
964 1164
     protected ViewGroup getRootView() {
965 1165
       return (ViewGroup) mReactContext.getCurrentActivity().findViewById(android.R.id.content);
966 1166
     }
1167
+
1168
+    public void setProgressChangedFilter(RNCWebView.ProgressChangedFilter filter) {
1169
+      progressChangedFilter = filter;
1170
+    }
967 1171
   }
968 1172
 
969 1173
   /**
@@ -973,14 +1177,27 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
973 1177
   protected static class RNCWebView extends WebView implements LifecycleEventListener {
974 1178
     protected @Nullable
975 1179
     String injectedJS;
1180
+    protected @Nullable
1181
+    String injectedJSBeforeContentLoaded;
1182
+
1183
+    /**
1184
+     * android.webkit.WebChromeClient fundamentally does not support JS injection into frames other
1185
+     * than the main frame, so these two properties are mostly here just for parity with iOS & macOS.
1186
+     */
1187
+    protected boolean injectedJavaScriptForMainFrameOnly = true;
1188
+    protected boolean injectedJavaScriptBeforeContentLoadedForMainFrameOnly = true;
1189
+
976 1190
     protected boolean messagingEnabled = false;
977 1191
     protected @Nullable
1192
+    String messagingModuleName;
1193
+    protected @Nullable
978 1194
     RNCWebViewClient mRNCWebViewClient;
979 1195
     protected @Nullable
980 1196
     CatalystInstance mCatalystInstance;
981 1197
     protected boolean sendContentSizeChangeEvents = false;
982 1198
     private OnScrollDispatchHelper mOnScrollDispatchHelper;
983 1199
     protected boolean hasScrollEvent = false;
1200
+    protected ProgressChangedFilter progressChangedFilter;
984 1201
 
985 1202
     /**
986 1203
      * WebView must be created with an context of the current activity
@@ -990,6 +1207,12 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
990 1207
      */
991 1208
     public RNCWebView(ThemedReactContext reactContext) {
992 1209
       super(reactContext);
1210
+      this.createCatalystInstance();
1211
+      progressChangedFilter = new ProgressChangedFilter();
1212
+    }
1213
+
1214
+    public void setIgnoreErrFailedForThisURL(String url) {
1215
+      mRNCWebViewClient.setIgnoreErrFailedForThisURL(url);
993 1216
     }
994 1217
 
995 1218
     public void setSendContentSizeChangeEvents(boolean sendContentSizeChangeEvents) {
@@ -1036,6 +1259,17 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1036 1259
       super.setWebViewClient(client);
1037 1260
       if (client instanceof RNCWebViewClient) {
1038 1261
         mRNCWebViewClient = (RNCWebViewClient) client;
1262
+        mRNCWebViewClient.setProgressChangedFilter(progressChangedFilter);
1263
+      }
1264
+    }
1265
+
1266
+    WebChromeClient mWebChromeClient;
1267
+    @Override
1268
+    public void setWebChromeClient(WebChromeClient client) {
1269
+      this.mWebChromeClient = client;
1270
+      super.setWebChromeClient(client);
1271
+      if (client instanceof RNCWebChromeClient) {
1272
+        ((RNCWebChromeClient) client).setProgressChangedFilter(progressChangedFilter);
1039 1273
       }
1040 1274
     }
1041 1275
 
@@ -1048,6 +1282,18 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1048 1282
       injectedJS = js;
1049 1283
     }
1050 1284
 
1285
+    public void setInjectedJavaScriptBeforeContentLoaded(@Nullable String js) {
1286
+      injectedJSBeforeContentLoaded = js;
1287
+    }
1288
+
1289
+    public void setInjectedJavaScriptForMainFrameOnly(boolean enabled) {
1290
+      injectedJavaScriptForMainFrameOnly = enabled;
1291
+    }
1292
+
1293
+    public void setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(boolean enabled) {
1294
+      injectedJavaScriptBeforeContentLoadedForMainFrameOnly = enabled;
1295
+    }
1296
+
1051 1297
     protected RNCWebViewBridge createRNCWebViewBridge(RNCWebView webView) {
1052 1298
       return new RNCWebViewBridge(webView);
1053 1299
     }
@@ -1070,12 +1316,15 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1070 1316
 
1071 1317
       if (enabled) {
1072 1318
         addJavascriptInterface(createRNCWebViewBridge(this), JAVASCRIPT_INTERFACE);
1073
-        this.createCatalystInstance();
1074 1319
       } else {
1075 1320
         removeJavascriptInterface(JAVASCRIPT_INTERFACE);
1076 1321
       }
1077 1322
     }
1078 1323
 
1324
+    public void setMessagingModuleName(String moduleName) {
1325
+      messagingModuleName = moduleName;
1326
+    }
1327
+
1079 1328
     protected void evaluateJavascriptWithFallback(String script) {
1080 1329
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
1081 1330
         evaluateJavascript(script, null);
@@ -1098,6 +1347,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1098 1347
       }
1099 1348
     }
1100 1349
 
1350
+    public void callInjectedJavaScriptBeforeContentLoaded() {
1351
+      if (getSettings().getJavaScriptEnabled() &&
1352
+      injectedJSBeforeContentLoaded != null &&
1353
+      !TextUtils.isEmpty(injectedJSBeforeContentLoaded)) {
1354
+        evaluateJavascriptWithFallback("(function() {\n" + injectedJSBeforeContentLoaded + ";\n})();");
1355
+      }
1356
+    }
1357
+
1101 1358
     public void onMessage(String message) {
1102 1359
       ReactContext reactContext = (ReactContext) this.getContext();
1103 1360
       RNCWebView mContext = this;
@@ -1114,7 +1371,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1114 1371
             data.putString("data", message);
1115 1372
 
1116 1373
             if (mCatalystInstance != null) {
1117
-              mContext.sendDirectMessage(data);
1374
+              mContext.sendDirectMessage("onMessage", data);
1118 1375
             } else {
1119 1376
               dispatchEvent(webView, new TopMessageEvent(webView.getId(), data));
1120 1377
             }
@@ -1125,21 +1382,21 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1125 1382
         eventData.putString("data", message);
1126 1383
 
1127 1384
         if (mCatalystInstance != null) {
1128
-          this.sendDirectMessage(eventData);
1385
+          this.sendDirectMessage("onMessage", eventData);
1129 1386
         } else {
1130 1387
           dispatchEvent(this, new TopMessageEvent(this.getId(), eventData));
1131 1388
         }
1132 1389
       }
1133 1390
     }
1134 1391
 
1135
-    protected void sendDirectMessage(WritableMap data) {
1392
+    protected void sendDirectMessage(final String method, WritableMap data) {
1136 1393
       WritableNativeMap event = new WritableNativeMap();
1137 1394
       event.putMap("nativeEvent", data);
1138 1395
 
1139 1396
       WritableNativeArray params = new WritableNativeArray();
1140 1397
       params.pushMap(event);
1141 1398
 
1142
-      mCatalystInstance.callFunction("WebViewMessageHandler", "onMessage", params);
1399
+      mCatalystInstance.callFunction(messagingModuleName, method, params);
1143 1400
     }
1144 1401
 
1145 1402
     protected void onScrollChanged(int x, int y, int oldX, int oldY) {
@@ -1175,6 +1432,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1175 1432
       destroy();
1176 1433
     }
1177 1434
 
1435
+    @Override
1436
+    public void destroy() {
1437
+      if (mWebChromeClient != null) {
1438
+        mWebChromeClient.onHideCustomView();
1439
+      }
1440
+      super.destroy();
1441
+    }
1442
+
1178 1443
     protected class RNCWebViewBridge {
1179 1444
       RNCWebView mContext;
1180 1445
 
@@ -1191,5 +1456,17 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1191 1456
         mContext.onMessage(message);
1192 1457
       }
1193 1458
     }
1459
+
1460
+    protected static class ProgressChangedFilter {
1461
+      private boolean waitingForCommandLoadUrl = false;
1462
+
1463
+      public void setWaitingForCommandLoadUrl(boolean isWaiting) {
1464
+        waitingForCommandLoadUrl = isWaiting;
1465
+      }
1466
+
1467
+      public boolean isWaitingForCommandLoadUrl() {
1468
+        return waitingForCommandLoadUrl;
1469
+      }
1470
+    }
1194 1471
   }
1195 1472
 }

+ 196
- 71
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java Zobrazit soubor

@@ -11,9 +11,13 @@ import android.os.Build;
11 11
 import android.os.Environment;
12 12
 import android.os.Parcelable;
13 13
 import android.provider.MediaStore;
14
+
15
+import androidx.annotation.Nullable;
14 16
 import androidx.annotation.RequiresApi;
15 17
 import androidx.core.content.ContextCompat;
16 18
 import androidx.core.content.FileProvider;
19
+import androidx.core.util.Pair;
20
+
17 21
 import android.util.Log;
18 22
 import android.webkit.MimeTypeMap;
19 23
 import android.webkit.ValueCallback;
@@ -33,6 +37,8 @@ import java.io.File;
33 37
 import java.io.IOException;
34 38
 import java.util.ArrayList;
35 39
 import java.util.Arrays;
40
+import java.util.HashMap;
41
+import java.util.concurrent.atomic.AtomicReference;
36 42
 
37 43
 import static android.app.Activity.RESULT_OK;
38 44
 
@@ -42,11 +48,53 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
42 48
   private static final int PICKER = 1;
43 49
   private static final int PICKER_LEGACY = 3;
44 50
   private static final int FILE_DOWNLOAD_PERMISSION_REQUEST = 1;
45
-  final String DEFAULT_MIME_TYPES = "*/*";
46 51
   private ValueCallback<Uri> filePathCallbackLegacy;
47 52
   private ValueCallback<Uri[]> filePathCallback;
48
-  private Uri outputFileUri;
53
+  private File outputImage;
54
+  private File outputVideo;
49 55
   private DownloadManager.Request downloadRequest;
56
+
57
+  protected static class ShouldOverrideUrlLoadingLock {
58
+    protected enum ShouldOverrideCallbackState {
59
+      UNDECIDED,
60
+      SHOULD_OVERRIDE,
61
+      DO_NOT_OVERRIDE,
62
+    }
63
+
64
+    private int nextLockIdentifier = 0;
65
+    private final HashMap<Integer, AtomicReference<ShouldOverrideCallbackState>> shouldOverrideLocks = new HashMap<>();
66
+
67
+    public synchronized Pair<Integer, AtomicReference<ShouldOverrideCallbackState>> getNewLock() {
68
+      final int lockIdentifier = nextLockIdentifier++;
69
+      final AtomicReference<ShouldOverrideCallbackState> shouldOverride = new AtomicReference<>(ShouldOverrideCallbackState.UNDECIDED);
70
+      shouldOverrideLocks.put(lockIdentifier, shouldOverride);
71
+      return new Pair<>(lockIdentifier, shouldOverride);
72
+    }
73
+
74
+    @Nullable
75
+    public synchronized AtomicReference<ShouldOverrideCallbackState> getLock(Integer lockIdentifier) {
76
+      return shouldOverrideLocks.get(lockIdentifier);
77
+    }
78
+
79
+    public synchronized void removeLock(Integer lockIdentifier) {
80
+      shouldOverrideLocks.remove(lockIdentifier);
81
+    }
82
+  }
83
+
84
+  protected static final ShouldOverrideUrlLoadingLock shouldOverrideUrlLoadingLock = new ShouldOverrideUrlLoadingLock();
85
+
86
+  private enum MimeType {
87
+    DEFAULT("*/*"),
88
+    IMAGE("image"),
89
+    VIDEO("video");
90
+
91
+    private final String value;
92
+
93
+    MimeType(String value) {
94
+      this.value = value;
95
+    }
96
+  }
97
+
50 98
   private PermissionListener webviewFileDownloaderPermissionListener = new PermissionListener() {
51 99
     @Override
52 100
     public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
@@ -90,12 +138,33 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
90 138
     promise.resolve(result);
91 139
   }
92 140
 
141
+  @ReactMethod(isBlockingSynchronousMethod = true)
142
+  public void onShouldStartLoadWithRequestCallback(final boolean shouldStart, final int lockIdentifier) {
143
+    final AtomicReference<ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState> lockObject = shouldOverrideUrlLoadingLock.getLock(lockIdentifier);
144
+    if (lockObject != null) {
145
+      synchronized (lockObject) {
146
+        lockObject.set(shouldStart ? ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState.DO_NOT_OVERRIDE : ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState.SHOULD_OVERRIDE);
147
+        lockObject.notify();
148
+      }
149
+    }
150
+  }
151
+
93 152
   public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
94 153
 
95 154
     if (filePathCallback == null && filePathCallbackLegacy == null) {
96 155
       return;
97 156
     }
98 157
 
158
+    boolean imageTaken = false;
159
+    boolean videoTaken = false;
160
+
161
+    if (outputImage != null && outputImage.length() > 0) {
162
+      imageTaken = true;
163
+    }
164
+    if (outputVideo != null && outputVideo.length() > 0) {
165
+      videoTaken = true;
166
+    }
167
+
99 168
     // based off of which button was pressed, we get an activity result and a file
100 169
     // the camera activity doesn't properly return the filename* (I think?) so we use
101 170
     // this filename instead
@@ -106,23 +175,42 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
106 175
             filePathCallback.onReceiveValue(null);
107 176
           }
108 177
         } else {
109
-          Uri result[] = this.getSelectedFiles(data, resultCode);
110
-          if (result != null) {
111
-            filePathCallback.onReceiveValue(result);
178
+          if (imageTaken) {
179
+            filePathCallback.onReceiveValue(new Uri[]{getOutputUri(outputImage)});
180
+          } else if (videoTaken) {
181
+            filePathCallback.onReceiveValue(new Uri[]{getOutputUri(outputVideo)});
112 182
           } else {
113
-            filePathCallback.onReceiveValue(new Uri[]{outputFileUri});
183
+            filePathCallback.onReceiveValue(this.getSelectedFiles(data, resultCode));
114 184
           }
115 185
         }
116 186
         break;
117 187
       case PICKER_LEGACY:
118
-        Uri result = resultCode != Activity.RESULT_OK ? null : data == null ? outputFileUri : data.getData();
119
-        filePathCallbackLegacy.onReceiveValue(result);
188
+        if (resultCode != RESULT_OK) {
189
+          filePathCallbackLegacy.onReceiveValue(null);
190
+        } else {
191
+          if (imageTaken) {
192
+            filePathCallbackLegacy.onReceiveValue(getOutputUri(outputImage));
193
+          } else if (videoTaken) {
194
+            filePathCallbackLegacy.onReceiveValue(getOutputUri(outputVideo));
195
+          } else {
196
+            filePathCallbackLegacy.onReceiveValue(data.getData());
197
+          }
198
+        }
120 199
         break;
121 200
 
122 201
     }
202
+
203
+    if (outputImage != null && !imageTaken) {
204
+      outputImage.delete();
205
+    }
206
+    if (outputVideo != null && !videoTaken) {
207
+      outputVideo.delete();
208
+    }
209
+
123 210
     filePathCallback = null;
124 211
     filePathCallbackLegacy = null;
125
-    outputFileUri = null;
212
+    outputImage = null;
213
+    outputVideo = null;
126 214
   }
127 215
 
128 216
   public void onNewIntent(Intent intent) {
@@ -133,15 +221,6 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
133 221
       return null;
134 222
     }
135 223
 
136
-    // we have one file selected
137
-    if (data.getData() != null) {
138
-      if (resultCode == RESULT_OK && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
139
-        return WebChromeClient.FileChooserParams.parseResult(resultCode, data);
140
-      } else {
141
-        return null;
142
-      }
143
-    }
144
-
145 224
     // we have multiple files selected
146 225
     if (data.getClipData() != null) {
147 226
       final int numSelectedFiles = data.getClipData().getItemCount();
@@ -151,6 +230,12 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
151 230
       }
152 231
       return result;
153 232
     }
233
+
234
+    // we have one file selected
235
+    if (data.getData() != null && resultCode == RESULT_OK && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
236
+      return WebChromeClient.FileChooserParams.parseResult(resultCode, data);
237
+    }
238
+
154 239
     return null;
155 240
   }
156 241
 
@@ -162,10 +247,16 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
162 247
 
163 248
     ArrayList<Parcelable> extraIntents = new ArrayList<>();
164 249
     if (acceptsImages(acceptType)) {
165
-      extraIntents.add(getPhotoIntent());
250
+      Intent photoIntent = getPhotoIntent();
251
+      if (photoIntent != null) {
252
+        extraIntents.add(photoIntent);
253
+      }
166 254
     }
167 255
     if (acceptsVideo(acceptType)) {
168
-      extraIntents.add(getVideoIntent());
256
+      Intent videoIntent = getVideoIntent();
257
+      if (videoIntent != null) {
258
+        extraIntents.add(videoIntent);
259
+      }
169 260
     }
170 261
     chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents.toArray(new Parcelable[]{}));
171 262
 
@@ -177,16 +268,22 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
177 268
   }
178 269
 
179 270
   @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
180
-  public boolean startPhotoPickerIntent(final ValueCallback<Uri[]> callback, final Intent intent, final String[] acceptTypes, final boolean allowMultiple) {
271
+  public boolean startPhotoPickerIntent(final ValueCallback<Uri[]> callback, final String[] acceptTypes, final boolean allowMultiple) {
181 272
     filePathCallback = callback;
182 273
 
183 274
     ArrayList<Parcelable> extraIntents = new ArrayList<>();
184
-    if (! needsCameraPermission()) {
275
+    if (!needsCameraPermission()) {
185 276
       if (acceptsImages(acceptTypes)) {
186
-        extraIntents.add(getPhotoIntent());
277
+        Intent photoIntent = getPhotoIntent();
278
+        if (photoIntent != null) {
279
+          extraIntents.add(photoIntent);
280
+        }
187 281
       }
188 282
       if (acceptsVideo(acceptTypes)) {
189
-        extraIntents.add(getVideoIntent());
283
+        Intent videoIntent = getVideoIntent();
284
+        if (videoIntent != null) {
285
+          extraIntents.add(videoIntent);
286
+        }
190 287
       }
191 288
     }
192 289
 
@@ -219,16 +316,13 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
219 316
   }
220 317
 
221 318
   public boolean grantFileDownloaderPermissions() {
222
-    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
319
+    // Permission not required for Android Q and above
320
+    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
223 321
       return true;
224 322
     }
225 323
 
226
-    boolean result = true;
227
-    if (ContextCompat.checkSelfPermission(getCurrentActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
228
-      result = false;
229
-    }
230
-
231
-    if (!result) {
324
+    boolean result = ContextCompat.checkSelfPermission(getCurrentActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
325
+    if (!result && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
232 326
       PermissionAwareActivity activity = getPermissionAwareActivity();
233 327
       activity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, FILE_DOWNLOAD_PERMISSION_REQUEST, webviewFileDownloaderPermissionListener);
234 328
     }
@@ -254,23 +348,41 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
254 348
   }
255 349
 
256 350
   private Intent getPhotoIntent() {
257
-    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
258
-    outputFileUri = getOutputUri(MediaStore.ACTION_IMAGE_CAPTURE);
259
-    intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
351
+    Intent intent = null;
352
+
353
+    try {
354
+      outputImage = getCapturedFile(MimeType.IMAGE);
355
+      Uri outputImageUri = getOutputUri(outputImage);
356
+      intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
357
+      intent.putExtra(MediaStore.EXTRA_OUTPUT, outputImageUri);
358
+    } catch (IOException | IllegalArgumentException e) {
359
+      Log.e("CREATE FILE", "Error occurred while creating the File", e);
360
+      e.printStackTrace();
361
+    }
362
+
260 363
     return intent;
261 364
   }
262 365
 
263 366
   private Intent getVideoIntent() {
264
-    Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
265
-    outputFileUri = getOutputUri(MediaStore.ACTION_VIDEO_CAPTURE);
266
-    intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
367
+    Intent intent = null;
368
+
369
+    try {
370
+      outputVideo = getCapturedFile(MimeType.VIDEO);
371
+      Uri outputVideoUri = getOutputUri(outputVideo);
372
+      intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
373
+      intent.putExtra(MediaStore.EXTRA_OUTPUT, outputVideoUri);
374
+    } catch (IOException | IllegalArgumentException e) {
375
+      Log.e("CREATE FILE", "Error occurred while creating the File", e);
376
+      e.printStackTrace();
377
+    }
378
+    
267 379
     return intent;
268 380
   }
269 381
 
270 382
   private Intent getFileChooserIntent(String acceptTypes) {
271 383
     String _acceptTypes = acceptTypes;
272 384
     if (acceptTypes.isEmpty()) {
273
-      _acceptTypes = DEFAULT_MIME_TYPES;
385
+      _acceptTypes = MimeType.DEFAULT.value;
274 386
     }
275 387
     if (acceptTypes.matches("\\.\\w+")) {
276 388
       _acceptTypes = getMimeTypeFromExtension(acceptTypes.replace(".", ""));
@@ -284,7 +396,7 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
284 396
   private Intent getFileChooserIntent(String[] acceptTypes, boolean allowMultiple) {
285 397
     Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
286 398
     intent.addCategory(Intent.CATEGORY_OPENABLE);
287
-    intent.setType("*/*");
399
+    intent.setType(MimeType.DEFAULT.value);
288 400
     intent.putExtra(Intent.EXTRA_MIME_TYPES, getAcceptedMimeType(acceptTypes));
289 401
     intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, allowMultiple);
290 402
     return intent;
@@ -295,25 +407,33 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
295 407
     if (types.matches("\\.\\w+")) {
296 408
       mimeType = getMimeTypeFromExtension(types.replace(".", ""));
297 409
     }
298
-    return mimeType.isEmpty() || mimeType.toLowerCase().contains("image");
410
+    return mimeType.isEmpty() || mimeType.toLowerCase().contains(MimeType.IMAGE.value);
299 411
   }
300 412
 
301 413
   private Boolean acceptsImages(String[] types) {
302 414
     String[] mimeTypes = getAcceptedMimeType(types);
303
-    return isArrayEmpty(mimeTypes) || arrayContainsString(mimeTypes, "image");
415
+    return arrayContainsString(mimeTypes, MimeType.DEFAULT.value) || arrayContainsString(mimeTypes, MimeType.IMAGE.value);
304 416
   }
305 417
 
306 418
   private Boolean acceptsVideo(String types) {
419
+    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
420
+      return false;
421
+    }
422
+
307 423
     String mimeType = types;
308 424
     if (types.matches("\\.\\w+")) {
309 425
       mimeType = getMimeTypeFromExtension(types.replace(".", ""));
310 426
     }
311
-    return mimeType.isEmpty() || mimeType.toLowerCase().contains("video");
427
+    return mimeType.isEmpty() || mimeType.toLowerCase().contains(MimeType.VIDEO.value);
312 428
   }
313 429
 
314 430
   private Boolean acceptsVideo(String[] types) {
431
+    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
432
+      return false;
433
+    }
434
+
315 435
     String[] mimeTypes = getAcceptedMimeType(types);
316
-    return isArrayEmpty(mimeTypes) || arrayContainsString(mimeTypes, "video");
436
+    return arrayContainsString(mimeTypes, MimeType.DEFAULT.value) || arrayContainsString(mimeTypes, MimeType.VIDEO.value);
317 437
   }
318 438
 
319 439
   private Boolean arrayContainsString(String[] array, String pattern) {
@@ -326,8 +446,8 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
326 446
   }
327 447
 
328 448
   private String[] getAcceptedMimeType(String[] types) {
329
-    if (isArrayEmpty(types)) {
330
-      return new String[]{DEFAULT_MIME_TYPES};
449
+    if (noAcceptTypesSet(types)) {
450
+      return new String[]{MimeType.DEFAULT.value};
331 451
     }
332 452
     String[] mimeTypes = new String[types.length];
333 453
     for (int i = 0; i < types.length; i++) {
@@ -335,7 +455,11 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
335 455
       // convert file extensions to mime types
336 456
       if (t.matches("\\.\\w+")) {
337 457
         String mimeType = getMimeTypeFromExtension(t.replace(".", ""));
338
-        mimeTypes[i] = mimeType;
458
+        if(mimeType != null) {
459
+          mimeTypes[i] = mimeType;
460
+        } else {
461
+          mimeTypes[i] = t;
462
+        }
339 463
       } else {
340 464
         mimeTypes[i] = t;
341 465
       }
@@ -351,15 +475,7 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
351 475
     return type;
352 476
   }
353 477
 
354
-  private Uri getOutputUri(String intentType) {
355
-    File capturedFile = null;
356
-    try {
357
-      capturedFile = getCapturedFile(intentType);
358
-    } catch (IOException e) {
359
-      Log.e("CREATE FILE", "Error occurred while creating the File", e);
360
-      e.printStackTrace();
361
-    }
362
-
478
+  private Uri getOutputUri(File capturedFile) {
363 479
     // for versions below 6.0 (23) we use the old File creation & permissions model
364 480
     if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
365 481
       return Uri.fromFile(capturedFile);
@@ -370,41 +486,50 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
370 486
     return FileProvider.getUriForFile(getReactApplicationContext(), packageName + ".fileprovider", capturedFile);
371 487
   }
372 488
 
373
-  private File getCapturedFile(String intentType) throws IOException {
489
+  private File getCapturedFile(MimeType mimeType) throws IOException {
374 490
     String prefix = "";
375 491
     String suffix = "";
376 492
     String dir = "";
377
-    String filename = "";
378 493
 
379
-    if (intentType.equals(MediaStore.ACTION_IMAGE_CAPTURE)) {
380
-      prefix = "image-";
381
-      suffix = ".jpg";
382
-      dir = Environment.DIRECTORY_PICTURES;
383
-    } else if (intentType.equals(MediaStore.ACTION_VIDEO_CAPTURE)) {
384
-      prefix = "video-";
385
-      suffix = ".mp4";
386
-      dir = Environment.DIRECTORY_MOVIES;
494
+    switch (mimeType) {
495
+      case IMAGE:
496
+        prefix = "image-";
497
+        suffix = ".jpg";
498
+        dir = Environment.DIRECTORY_PICTURES;
499
+        break;
500
+      case VIDEO:
501
+        prefix = "video-";
502
+        suffix = ".mp4";
503
+        dir = Environment.DIRECTORY_MOVIES;
504
+        break;
505
+
506
+      default:
507
+        break;
387 508
     }
388 509
 
389
-    filename = prefix + String.valueOf(System.currentTimeMillis()) + suffix;
510
+    String filename = prefix + String.valueOf(System.currentTimeMillis()) + suffix;
511
+    File outputFile = null;
390 512
 
391 513
     // for versions below 6.0 (23) we use the old File creation & permissions model
392 514
     if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
393 515
       // only this Directory works on all tested Android versions
394 516
       // ctx.getExternalFilesDir(dir) was failing on Android 5.0 (sdk 21)
395 517
       File storageDir = Environment.getExternalStoragePublicDirectory(dir);
396
-      return new File(storageDir, filename);
518
+      outputFile = new File(storageDir, filename);
519
+    } else {
520
+      File storageDir = getReactApplicationContext().getExternalFilesDir(null);
521
+      outputFile = File.createTempFile(prefix, suffix, storageDir);
397 522
     }
398 523
 
399
-    File storageDir = getReactApplicationContext().getExternalFilesDir(null);
400
-    return File.createTempFile(filename, suffix, storageDir);
524
+    return outputFile;
401 525
   }
402 526
 
403
-  private Boolean isArrayEmpty(String[] arr) {
527
+  private Boolean noAcceptTypesSet(String[] types) {
404 528
     // when our array returned from getAcceptTypes() has no values set from the webview
405 529
     // i.e. <input type="file" />, without any "accept" attr
406 530
     // will be an array with one empty string element, afaik
407
-    return arr.length == 0 || (arr.length == 1 && arr[0].length() == 0);
531
+
532
+    return types.length == 0 || (types.length == 1 && types[0] != null && types[0].length() == 0);
408 533
   }
409 534
 
410 535
   private PermissionAwareActivity getPermissionAwareActivity() {

+ 26
- 0
android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt Zobrazit soubor

@@ -0,0 +1,26 @@
1
+package com.reactnativecommunity.webview.events
2
+
3
+import com.facebook.react.bridge.WritableMap
4
+import com.facebook.react.uimanager.events.Event
5
+import com.facebook.react.uimanager.events.RCTEventEmitter
6
+
7
+/**
8
+ * Event emitted when the WebView's process has crashed or
9
+   was killed by the OS.
10
+ */
11
+class TopRenderProcessGoneEvent(viewId: Int, private val mEventData: WritableMap) :
12
+  Event<TopRenderProcessGoneEvent>(viewId) {
13
+  companion object {
14
+    const val EVENT_NAME = "topRenderProcessGone"
15
+  }
16
+
17
+  override fun getEventName(): String = EVENT_NAME
18
+
19
+  override fun canCoalesce(): Boolean = false
20
+
21
+  override fun getCoalescingKey(): Short = 0
22
+
23
+  override fun dispatch(rctEventEmitter: RCTEventEmitter) =
24
+    rctEventEmitter.receiveEvent(viewTag, eventName, mEventData)
25
+
26
+}

+ 2
- 0
android/src/main/java/com/reactnativecommunity/webview/events/TopShouldStartLoadWithRequestEvent.kt Zobrazit soubor

@@ -14,6 +14,8 @@ class TopShouldStartLoadWithRequestEvent(viewId: Int, private val mData: Writabl
14 14
 
15 15
   init {
16 16
     mData.putString("navigationType", "other")
17
+    // Android does not raise shouldOverrideUrlLoading for inner frames
18
+    mData.putBoolean("isTopFrame", true)
17 19
   }
18 20
 
19 21
   override fun getEventName(): String = EVENT_NAME

ios/RNCWKProcessPoolManager.h → apple/RNCWKProcessPoolManager.h Zobrazit soubor


ios/RNCWKProcessPoolManager.m → apple/RNCWKProcessPoolManager.m Zobrazit soubor


ios/RNCWebView.h → apple/RNCWebView.h Zobrazit soubor

@@ -54,12 +54,20 @@
54 54
 @property (nonatomic, copy) NSString * _Nullable applicationNameForUserAgent;
55 55
 @property (nonatomic, assign) BOOL cacheEnabled;
56 56
 @property (nonatomic, assign) BOOL javaScriptEnabled;
57
+@property (nonatomic, assign) BOOL javaScriptCanOpenWindowsAutomatically;
57 58
 @property (nonatomic, assign) BOOL allowFileAccessFromFileURLs;
58 59
 @property (nonatomic, assign) BOOL allowsLinkPreview;
59 60
 @property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
60 61
 @property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
61 62
 @property (nonatomic, assign) BOOL directionalLockEnabled;
63
+@property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
62 64
 @property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
65
+@property (nonatomic, assign) BOOL pullToRefreshEnabled;
66
+@property (nonatomic, weak) UIRefreshControl * refreshControl;
67
+
68
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
69
+@property (nonatomic, assign) WKContentMode contentMode;
70
+#endif
63 71
 
64 72
 + (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;
65 73
 + (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates;
@@ -69,5 +77,7 @@
69 77
 - (void)goBack;
70 78
 - (void)reload;
71 79
 - (void)stopLoading;
80
+- (void)addPullToRefreshControl;
81
+- (void)pullToRefresh:(UIRefreshControl *)refreshControl;
72 82
 
73 83
 @end

ios/RNCWebView.m → apple/RNCWebView.m Zobrazit soubor

@@ -67,6 +67,8 @@ static NSDictionary* customCertificatesForHost;
67 67
     UIScrollViewDelegate,
68 68
 #endif // !TARGET_OS_OSX
69 69
     RCTAutoInsetsProtocol>
70
+
71
+@property (nonatomic, copy) RCTDirectEventBlock onFileDownload;
70 72
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingStart;
71 73
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingFinish;
72 74
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingError;
@@ -140,6 +142,15 @@ static NSDictionary* customCertificatesForHost;
140 142
   }
141 143
 
142 144
 #if !TARGET_OS_OSX
145
+    [[NSNotificationCenter defaultCenter]addObserver:self
146
+    selector:@selector(appDidBecomeActive)
147
+        name:UIApplicationDidBecomeActiveNotification
148
+      object:nil];
149
+
150
+    [[NSNotificationCenter defaultCenter]addObserver:self
151
+    selector:@selector(appWillResignActive)
152
+        name:UIApplicationWillResignActiveNotification
153
+      object:nil];
143 154
   if (@available(iOS 12.0, *)) {
144 155
     // Workaround for a keyboard dismissal bug present in iOS 12
145 156
     // https://openradar.appspot.com/radar?id=5018321736957952
@@ -163,6 +174,7 @@ static NSDictionary* customCertificatesForHost;
163 174
                                                selector:@selector(hideFullScreenVideoStatusBars)
164 175
                                                    name:UIWindowDidBecomeHiddenNotification
165 176
                                                  object:nil];
177
+
166 178
   }
167 179
 #endif // !TARGET_OS_OSX
168 180
   return self;
@@ -197,6 +209,10 @@ static NSDictionary* customCertificatesForHost;
197 209
     [prefs setValue:@TRUE forKey:@"allowFileAccessFromFileURLs"];
198 210
     _prefsUsed = YES;
199 211
   }
212
+  if (_javaScriptCanOpenWindowsAutomatically) {
213
+    [prefs setValue:@TRUE forKey:@"javaScriptCanOpenWindowsAutomatically"];
214
+    _prefsUsed = YES;
215
+  }
200 216
   if (_prefsUsed) {
201 217
     wkWebViewConfig.preferences = prefs;
202 218
   }
@@ -210,6 +226,14 @@ static NSDictionary* customCertificatesForHost;
210 226
   }
211 227
   wkWebViewConfig.userContentController = [WKUserContentController new];
212 228
 
229
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
230
+  if (@available(iOS 13.0, *)) {
231
+    WKWebpagePreferences *pagePrefs = [[WKWebpagePreferences alloc]init];
232
+    pagePrefs.preferredContentMode = _contentMode;
233
+    wkWebViewConfig.defaultWebpagePreferences = pagePrefs;
234
+  }
235
+#endif
236
+
213 237
   // Shim the HTML5 history API:
214 238
   [wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]
215 239
                                                             name:HistoryShimName];
@@ -230,7 +254,7 @@ static NSDictionary* customCertificatesForHost;
230 254
   if (_applicationNameForUserAgent) {
231 255
       wkWebViewConfig.applicationNameForUserAgent = [NSString stringWithFormat:@"%@ %@", wkWebViewConfig.applicationNameForUserAgent, _applicationNameForUserAgent];
232 256
   }
233
-  
257
+
234 258
   return wkWebViewConfig;
235 259
 }
236 260
 
@@ -251,9 +275,13 @@ static NSDictionary* customCertificatesForHost;
251 275
     _webView.UIDelegate = self;
252 276
     _webView.navigationDelegate = self;
253 277
 #if !TARGET_OS_OSX
278
+    if (_pullToRefreshEnabled) {
279
+        [self addPullToRefreshControl];
280
+    }
254 281
     _webView.scrollView.scrollEnabled = _scrollEnabled;
255 282
     _webView.scrollView.pagingEnabled = _pagingEnabled;
256
-    _webView.scrollView.bounces = _bounces;
283
+      //For UIRefreshControl to work correctly, the bounces should always be true
284
+    _webView.scrollView.bounces = _pullToRefreshEnabled || _bounces; 
257 285
     _webView.scrollView.showsHorizontalScrollIndicator = _showsHorizontalScrollIndicator;
258 286
     _webView.scrollView.showsVerticalScrollIndicator = _showsVerticalScrollIndicator;
259 287
     _webView.scrollView.directionalLockEnabled = _directionalLockEnabled;
@@ -284,7 +312,6 @@ static NSDictionary* customCertificatesForHost;
284 312
   _webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
285 313
 }
286 314
 
287
-
288 315
 - (void)removeFromSuperview
289 316
 {
290 317
     if (_webView) {
@@ -294,6 +321,10 @@ static NSDictionary* customCertificatesForHost;
294 321
         _webView.scrollView.delegate = nil;
295 322
 #endif // !TARGET_OS_OSX
296 323
         _webView = nil;
324
+        if (_onContentProcessDidTerminate) {
325
+          NSMutableDictionary<NSString *, id> *event = [self baseEvent];
326
+          _onContentProcessDidTerminate(event);
327
+        }
297 328
     }
298 329
 
299 330
     [super removeFromSuperview];
@@ -848,40 +879,9 @@ static NSDictionary* customCertificatesForHost;
848 879
  * topViewController
849 880
  */
850 881
 -(UIViewController *)topViewController{
851
-    UIViewController *controller = [self topViewControllerWithRootViewController:[self getCurrentWindow].rootViewController];
852
-    return controller;
882
+    return RCTPresentedViewController();
853 883
 }
854 884
 
855
-/**
856
- * topViewControllerWithRootViewController
857
- */
858
--(UIViewController *)topViewControllerWithRootViewController:(UIViewController *)viewController{
859
-  if (viewController==nil) return nil;
860
-  if (viewController.presentedViewController!=nil) {
861
-    return [self topViewControllerWithRootViewController:viewController.presentedViewController];
862
-  } else if ([viewController isKindOfClass:[UITabBarController class]]){
863
-    return [self topViewControllerWithRootViewController:[(UITabBarController *)viewController selectedViewController]];
864
-  } else if ([viewController isKindOfClass:[UINavigationController class]]){
865
-    return [self topViewControllerWithRootViewController:[(UINavigationController *)viewController visibleViewController]];
866
-  } else {
867
-    return viewController;
868
-  }
869
-}
870
-/**
871
- * getCurrentWindow
872
- */
873
--(UIWindow *)getCurrentWindow{
874
-  UIWindow *window = [UIApplication sharedApplication].keyWindow;
875
-  if (window.windowLevel!=UIWindowLevelNormal) {
876
-    for (UIWindow *wid in [UIApplication sharedApplication].windows) {
877
-      if (window.windowLevel==UIWindowLevelNormal) {
878
-        window = wid;
879
-        break;
880
-      }
881
-    }
882
-  }
883
-  return window;
884
-}
885 885
 #endif // !TARGET_OS_OSX
886 886
 
887 887
 /**
@@ -908,13 +908,15 @@ static NSDictionary* customCertificatesForHost;
908 908
 
909 909
   WKNavigationType navigationType = navigationAction.navigationType;
910 910
   NSURLRequest *request = navigationAction.request;
911
+  BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL];
911 912
 
912 913
   if (_onShouldStartLoadWithRequest) {
913 914
     NSMutableDictionary<NSString *, id> *event = [self baseEvent];
914 915
     [event addEntriesFromDictionary: @{
915 916
       @"url": (request.URL).absoluteString,
916 917
       @"mainDocumentURL": (request.mainDocumentURL).absoluteString,
917
-      @"navigationType": navigationTypes[@(navigationType)]
918
+      @"navigationType": navigationTypes[@(navigationType)],
919
+      @"isTopFrame": @(isTopFrame)
918 920
     }];
919 921
     if (![self.delegate webView:self
920 922
       shouldStartLoadForRequest:event
@@ -926,7 +928,6 @@ static NSDictionary* customCertificatesForHost;
926 928
 
927 929
   if (_onLoadingStart) {
928 930
     // We have this check to filter out iframe requests and whatnot
929
-    BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL];
930 931
     if (isTopFrame) {
931 932
       NSMutableDictionary<NSString *, id> *event = [self baseEvent];
932 933
       [event addEntriesFromDictionary: @{
@@ -962,24 +963,42 @@ static NSDictionary* customCertificatesForHost;
962 963
   decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse
963 964
                     decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler
964 965
 {
966
+  WKNavigationResponsePolicy policy = WKNavigationResponsePolicyAllow;
965 967
   if (_onHttpError && navigationResponse.forMainFrame) {
966 968
     if ([navigationResponse.response isKindOfClass:[NSHTTPURLResponse class]]) {
967 969
       NSHTTPURLResponse *response = (NSHTTPURLResponse *)navigationResponse.response;
968 970
       NSInteger statusCode = response.statusCode;
969 971
 
970 972
       if (statusCode >= 400) {
971
-        NSMutableDictionary<NSString *, id> *event = [self baseEvent];
972
-        [event addEntriesFromDictionary: @{
973
+        NSMutableDictionary<NSString *, id> *httpErrorEvent = [self baseEvent];
974
+        [httpErrorEvent addEntriesFromDictionary: @{
973 975
           @"url": response.URL.absoluteString,
974 976
           @"statusCode": @(statusCode)
975 977
         }];
976 978
 
977
-        _onHttpError(event);
979
+        _onHttpError(httpErrorEvent);
980
+      }
981
+
982
+      NSString *disposition = nil;
983
+      if (@available(iOS 13, *)) {
984
+        disposition = [response valueForHTTPHeaderField:@"Content-Disposition"];
985
+      }
986
+      BOOL isAttachment = disposition != nil && [disposition hasPrefix:@"attachment"];
987
+      if (isAttachment || !navigationResponse.canShowMIMEType) {
988
+        if (_onFileDownload) {
989
+          policy = WKNavigationResponsePolicyCancel;
990
+
991
+          NSMutableDictionary<NSString *, id> *downloadEvent = [self baseEvent];
992
+          [downloadEvent addEntriesFromDictionary: @{
993
+            @"downloadUrl": (response.URL).absoluteString,
994
+          }];
995
+          _onFileDownload(downloadEvent);
996
+        }
978 997
       }
979 998
     }
980 999
   }
981 1000
 
982
-  decisionHandler(WKNavigationResponsePolicyAllow);
1001
+  decisionHandler(policy);
983 1002
 }
984 1003
 
985 1004
 /**
@@ -1030,6 +1049,37 @@ static NSDictionary* customCertificatesForHost;
1030 1049
   }];
1031 1050
 }
1032 1051
 
1052
+-(void)forceIgnoreSilentHardwareSwitch:(BOOL)initialSetup
1053
+{
1054
+    NSString *mp3Str = @"data:audio/mp3;base64,//tAxAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAAFAAAESAAzMzMzMzMzMzMzMzMzMzMzMzMzZmZmZmZmZmZmZmZmZmZmZmZmZmaZmZmZmZmZmZmZmZmZmZmZmZmZmczMzMzMzMzMzMzMzMzMzMzMzMzM//////////////////////////8AAAA5TEFNRTMuMTAwAZYAAAAAAAAAABQ4JAMGQgAAOAAABEhNIZS0AAAAAAD/+0DEAAPH3Yz0AAR8CPqyIEABp6AxjG/4x/XiInE4lfQDFwIIRE+uBgZoW4RL0OLMDFn6E5v+/u5ehf76bu7/6bu5+gAiIQGAABQIUJ0QolFghEn/9PhZQpcUTpXMjo0OGzRCZXyKxoIQzB2KhCtGobpT9TRVj/3Pmfp+f8X7Pu1B04sTnc3s0XhOlXoGVCMNo9X//9/r6a10TZEY5DsxqvO7mO5qFvpFCmKIjhpSItGsUYcRO//7QsQRgEiljQIAgLFJAbIhNBCa+JmorCbOi5q9nVd2dKnusTMQg4MFUlD6DQ4OFijwGAijRMfLbHG4nLVTjydyPlJTj8pfPflf9/5GD950A5e+jsrmNZSjSirjs1R7hnkia8vr//l/7Nb+crvr9Ok5ZJOylUKRxf/P9Zn0j2P4pJYXyKkeuy5wUYtdmOu6uobEtFqhIJViLEKIjGxchGev/L3Y0O3bwrIOszTBAZ7Ih28EUaSOZf/7QsQfg8fpjQIADN0JHbGgQBAZ8T//y//t/7d/2+f5m7MdCeo/9tdkMtGLbt1tqnabRroO1Qfvh20yEbei8nfDXP7btW7f9/uO9tbe5IvHQbLlxpf3DkAk0ojYcv///5/u3/7PTfGjPEPUvt5D6f+/3Lea4lz4tc4TnM/mFPrmalWbboeNiNyeyr+vufttZuvrVrt/WYv3T74JFo8qEDiJqJrmDTs///v99xDku2xG02jjunrICP/7QsQtA8kpkQAAgNMA/7FgQAGnobgfghgqA+uXwWQ3XFmGimSbe2X3ksY//KzK1a2k6cnNWOPJnPWUsYbKqkh8RJzrVf///P///////4vyhLKHLrCb5nIrYIUss4cthigL1lQ1wwNAc6C1pf1TIKRSkt+a//z+yLVcwlXKSqeSuCVQFLng2h4AFAFgTkH+Z/8jTX/zr//zsJV/5f//5UX/0ZNCNCCaf5lTCTRkaEdhNP//n/KUjf/7QsQ5AEhdiwAAjN7I6jGddBCO+WGTQ1mXrYatSAgaykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqg==";
1055
+    NSString *scr;
1056
+    if (initialSetup) {
1057
+        scr = [NSString stringWithFormat:@"var s=new Audio('%@');s.id='wkwebviewAudio';s.controls=false;s.loop=true;s.play();document.body.appendChild(s);true", mp3Str];
1058
+    } else {
1059
+        scr = [NSString stringWithFormat:@"var s=document.getElementById('wkwebviewAudio');s.src=null;s.parentNode.removeChild(s);s=null;s=new Audio('%@');s.id='wkwebviewAudio';s.controls=false;s.loop=true;s.play();document.body.appendChild(s);true", mp3Str];
1060
+    }
1061
+    [self evaluateJS: scr thenCall: nil];
1062
+}
1063
+
1064
+-(void)disableIgnoreSilentSwitch
1065
+{
1066
+    [self evaluateJS: @"document.getElementById('wkwebviewAudio').src=null;true" thenCall: nil];
1067
+}
1068
+
1069
+-(void)appDidBecomeActive
1070
+{
1071
+    if (_ignoreSilentHardwareSwitch) {
1072
+      [self forceIgnoreSilentHardwareSwitch:false];
1073
+    }
1074
+}
1075
+
1076
+-(void)appWillResignActive
1077
+{
1078
+  if (_ignoreSilentHardwareSwitch) {
1079
+    [self disableIgnoreSilentSwitch];
1080
+  }
1081
+}
1082
+
1033 1083
 /**
1034 1084
  * Called when the navigation is complete.
1035 1085
  * @see https://fburl.com/rtys6jlb
@@ -1037,6 +1087,10 @@ static NSDictionary* customCertificatesForHost;
1037 1087
 - (void)webView:(WKWebView *)webView
1038 1088
   didFinishNavigation:(WKNavigation *)navigation
1039 1089
 {
1090
+  if (_ignoreSilentHardwareSwitch) {
1091
+    [self forceIgnoreSilentHardwareSwitch:true];
1092
+  }
1093
+
1040 1094
   if (_onLoadingFinish) {
1041 1095
     _onLoadingFinish([self baseEvent]);
1042 1096
   }
@@ -1073,6 +1127,35 @@ static NSDictionary* customCertificatesForHost;
1073 1127
   }
1074 1128
 }
1075 1129
 
1130
+- (void)addPullToRefreshControl
1131
+{
1132
+    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
1133
+    _refreshControl = refreshControl;
1134
+    [_webView.scrollView addSubview: refreshControl];
1135
+    [refreshControl addTarget:self action:@selector(pullToRefresh:) forControlEvents: UIControlEventValueChanged];
1136
+}
1137
+
1138
+- (void)pullToRefresh:(UIRefreshControl *)refreshControl
1139
+{
1140
+    [self reload];
1141
+    [refreshControl endRefreshing];
1142
+}
1143
+
1144
+#if !TARGET_OS_OSX
1145
+- (void)setPullToRefreshEnabled:(BOOL)pullToRefreshEnabled
1146
+{
1147
+    _pullToRefreshEnabled = pullToRefreshEnabled;
1148
+    
1149
+    if (pullToRefreshEnabled) {
1150
+        [self addPullToRefreshControl];
1151
+    } else {
1152
+        [_refreshControl removeFromSuperview];
1153
+    }
1154
+
1155
+    [self setBounces:_bounces];
1156
+}
1157
+#endif // !TARGET_OS_OSX
1158
+
1076 1159
 - (void)stopLoading
1077 1160
 {
1078 1161
   [_webView stopLoading];
@@ -1082,18 +1165,18 @@ static NSDictionary* customCertificatesForHost;
1082 1165
 - (void)setBounces:(BOOL)bounces
1083 1166
 {
1084 1167
   _bounces = bounces;
1085
-  _webView.scrollView.bounces = bounces;
1168
+    //For UIRefreshControl to work correctly, the bounces should always be true
1169
+  _webView.scrollView.bounces = _pullToRefreshEnabled || bounces;
1086 1170
 }
1087 1171
 #endif // !TARGET_OS_OSX
1088 1172
 
1089
-
1090 1173
 - (void)setInjectedJavaScript:(NSString *)source {
1091 1174
   _injectedJavaScript = source;
1092
-  
1175
+
1093 1176
   self.atEndScript = source == nil ? nil : [[WKUserScript alloc] initWithSource:source
1094 1177
       injectionTime:WKUserScriptInjectionTimeAtDocumentEnd
1095 1178
     forMainFrameOnly:_injectedJavaScriptForMainFrameOnly];
1096
-  
1179
+
1097 1180
   if(_webView != nil){
1098 1181
     [self resetupScripts:_webView.configuration];
1099 1182
   }
@@ -1101,11 +1184,11 @@ static NSDictionary* customCertificatesForHost;
1101 1184
 
1102 1185
 - (void)setInjectedJavaScriptBeforeContentLoaded:(NSString *)source {
1103 1186
   _injectedJavaScriptBeforeContentLoaded = source;
1104
-  
1187
+
1105 1188
   self.atStartScript = source == nil ? nil : [[WKUserScript alloc] initWithSource:source
1106 1189
        injectionTime:WKUserScriptInjectionTimeAtDocumentStart
1107 1190
     forMainFrameOnly:_injectedJavaScriptBeforeContentLoadedForMainFrameOnly];
1108
-  
1191
+
1109 1192
   if(_webView != nil){
1110 1193
     [self resetupScripts:_webView.configuration];
1111 1194
   }
@@ -1123,7 +1206,7 @@ static NSDictionary* customCertificatesForHost;
1123 1206
 
1124 1207
 - (void)setMessagingEnabled:(BOOL)messagingEnabled {
1125 1208
   _messagingEnabled = messagingEnabled;
1126
-  
1209
+
1127 1210
   self.postMessageScript = _messagingEnabled ?
1128 1211
   [
1129 1212
    [WKUserScript alloc]
@@ -1143,7 +1226,7 @@ static NSDictionary* customCertificatesForHost;
1143 1226
    forMainFrameOnly:YES
1144 1227
    ] :
1145 1228
   nil;
1146
-  
1229
+
1147 1230
   if(_webView != nil){
1148 1231
     [self resetupScripts:_webView.configuration];
1149 1232
   }
@@ -1152,7 +1235,7 @@ static NSDictionary* customCertificatesForHost;
1152 1235
 - (void)resetupScripts:(WKWebViewConfiguration *)wkWebViewConfig {
1153 1236
   [wkWebViewConfig.userContentController removeAllUserScripts];
1154 1237
   [wkWebViewConfig.userContentController removeScriptMessageHandlerForName:MessageHandlerName];
1155
-  
1238
+
1156 1239
   NSString *html5HistoryAPIShimSource = [NSString stringWithFormat:
1157 1240
     @"(function(history) {\n"
1158 1241
     "  function notify(type) {\n"
@@ -1175,7 +1258,7 @@ static NSDictionary* customCertificatesForHost;
1175 1258
   ];
1176 1259
   WKUserScript *script = [[WKUserScript alloc] initWithSource:html5HistoryAPIShimSource injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES];
1177 1260
   [wkWebViewConfig.userContentController addUserScript:script];
1178
-  
1261
+
1179 1262
   if(_sharedCookiesEnabled) {
1180 1263
     // More info to sending cookies with WKWebView
1181 1264
     // https://stackoverflow.com/questions/26573137/can-i-set-the-cookies-to-be-used-by-a-wkwebview/26577303#26577303
@@ -1237,7 +1320,7 @@ static NSDictionary* customCertificatesForHost;
1237 1320
       [wkWebViewConfig.userContentController addUserScript:cookieInScript];
1238 1321
     }
1239 1322
   }
1240
-  
1323
+
1241 1324
   if(_messagingEnabled){
1242 1325
     if (self.postMessageScript){
1243 1326
       [wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]

ios/RNCWebViewManager.h → apple/RNCWebViewManager.h Zobrazit soubor


ios/RNCWebViewManager.m → apple/RNCWebViewManager.m Zobrazit soubor

@@ -14,6 +14,16 @@
14 14
 @interface RNCWebViewManager () <RNCWebViewDelegate>
15 15
 @end
16 16
 
17
+@implementation RCTConvert (WKWebView)
18
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
19
+RCT_ENUM_CONVERTER(WKContentMode, (@{
20
+    @"recommended": @(WKContentModeRecommended),
21
+    @"mobile": @(WKContentModeMobile),
22
+    @"desktop": @(WKContentModeDesktop),
23
+}), WKContentModeRecommended, integerValue)
24
+#endif
25
+@end
26
+
17 27
 @implementation RNCWebViewManager
18 28
 {
19 29
   NSConditionLock *_shouldStartLoadLock;
@@ -34,6 +44,7 @@ RCT_EXPORT_MODULE()
34 44
 }
35 45
 
36 46
 RCT_EXPORT_VIEW_PROPERTY(source, NSDictionary)
47
+RCT_EXPORT_VIEW_PROPERTY(onFileDownload, RCTDirectEventBlock)
37 48
 RCT_EXPORT_VIEW_PROPERTY(onLoadingStart, RCTDirectEventBlock)
38 49
 RCT_EXPORT_VIEW_PROPERTY(onLoadingFinish, RCTDirectEventBlock)
39 50
 RCT_EXPORT_VIEW_PROPERTY(onLoadingError, RCTDirectEventBlock)
@@ -46,6 +57,7 @@ RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptBeforeContentLoaded, NSString)
46 57
 RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptForMainFrameOnly, BOOL)
47 58
 RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptBeforeContentLoadedForMainFrameOnly, BOOL)
48 59
 RCT_EXPORT_VIEW_PROPERTY(javaScriptEnabled, BOOL)
60
+RCT_EXPORT_VIEW_PROPERTY(javaScriptCanOpenWindowsAutomatically, BOOL)
49 61
 RCT_EXPORT_VIEW_PROPERTY(allowFileAccessFromFileURLs, BOOL)
50 62
 RCT_EXPORT_VIEW_PROPERTY(allowsInlineMediaPlayback, BOOL)
51 63
 RCT_EXPORT_VIEW_PROPERTY(mediaPlaybackRequiresUserAction, BOOL)
@@ -68,6 +80,10 @@ RCT_EXPORT_VIEW_PROPERTY(allowingReadAccessToURL, NSString)
68 80
 RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior)
69 81
 #endif
70 82
 
83
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
84
+RCT_EXPORT_VIEW_PROPERTY(contentMode, WKContentMode)
85
+#endif
86
+
71 87
 /**
72 88
  * Expose methods to enable messaging the webview.
73 89
  */
@@ -87,6 +103,10 @@ RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)m
87 103
   }];
88 104
 }
89 105
 
106
+RCT_CUSTOM_VIEW_PROPERTY(pullToRefreshEnabled, BOOL, RNCWebView) {
107
+    view.pullToRefreshEnabled = json == nil ? false : [RCTConvert BOOL: json];
108
+}
109
+
90 110
 RCT_CUSTOM_VIEW_PROPERTY(bounces, BOOL, RNCWebView) {
91 111
   view.bounces = json == nil ? true : [RCTConvert BOOL: json];
92 112
 }

+ 1
- 1
docs/Custom-Android.md Zobrazit soubor

@@ -1,6 +1,6 @@
1 1
 While the built-in web view has a lot of features, it is not possible to handle every use-case in React Native. You can, however, extend the web view with native code without forking React Native or duplicating all the existing web view code.
2 2
 
3
-Before you do this, you should be familiar with the concepts in [native UI components](https://reactnative.dev/docs/native-components-android). You should also familiarise yourself with the [native code for web views](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java), as you will have to use this as a reference when implementing new features—although a deep understanding is not required.
3
+Before you do this, you should be familiar with the concepts in [native UI components](https://reactnative.dev/docs/native-components-android). You should also familiarise yourself with the [native code for web views](https://github.com/react-native-community/react-native-webview/blob/master/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java), as you will have to use this as a reference when implementing new features—although a deep understanding is not required.
4 4
 
5 5
 ## Native Code
6 6
 

+ 3
- 1
docs/Debugging.md Zobrazit soubor

@@ -15,12 +15,14 @@ It's possible to debug WebView contents in the iOS simulator or on a device usin
15 15
 3. Safari -> Develop -> [device name] -> [app name] -> [url - title]
16 16
 4. You can now debug the WebView contents just as you would on the web
17 17
 
18
-##### Note:
18
+##### Notes:
19 19
 
20 20
 When debugging on device you must enable Web Inspector in your device settings:
21 21
 
22 22
 Settings -> Safari -> Advanced -> Web Inspector
23 23
 
24
+Also, if you don't see your device in the Develop menu, and you started Safari before you started your simulator, try restarting Safari.
25
+
24 26
 ### Android & Chrome
25 27
 
26 28
 It's possible to debug WebView contents in the Android emulator or on a device using Chrome DevTools.

+ 5
- 11
docs/Getting-Started.md Zobrazit soubor

@@ -28,16 +28,16 @@ $ react-native link react-native-webview
28 28
 
29 29
 _NOTE: If you ever need to uninstall React Native WebView, run `react-native unlink react-native-webview` to unlink it._
30 30
 
31
-### iOS:
31
+### iOS & macOS:
32 32
 
33
-If using cocoapods in the `ios/` directory run
33
+If using CocoaPods, in the `ios/` or `macos/` directory run:
34 34
 
35 35
 ```
36 36
 $ pod install
37 37
 ```
38 38
 
39
-For iOS, while you can manually link the old way using [react-native own tutorial](https://reactnative.dev/docs/linking-libraries-ios), we find it easier to use cocoapods.
40
-If you wish to use cocoapods and haven't set it up yet, please instead refer to [that article](https://engineering.brigad.co/demystifying-react-native-modules-linking-ae6c017a6b4a).
39
+While you can manually link the old way using [react-native own tutorial](https://reactnative.dev/docs/linking-libraries-ios), we find it easier to use CocoaPods.
40
+If you wish to use CocoaPods and haven't set it up yet, please instead refer to [that article](https://engineering.brigad.co/demystifying-react-native-modules-linking-ae6c017a6b4a).
41 41
 
42 42
 ### Android:
43 43
 
@@ -54,12 +54,6 @@ android.enableJetifier=true
54 54
 
55 55
 For Android manual installation, please refer to [this article](https://engineering.brigad.co/demystifying-react-native-modules-linking-964399ec731b) where you can find detailed step on how to link any react-native project.
56 56
 
57
-### macOS:
58
-
59
-Cocoapod and autolinking is not yet support for react-native macOS but is coming soon. In the meantime you must manually link.
60
-
61
-The method is nearly identical to the [manual linking method for iOS](https://reactnative.dev/docs/linking-libraries-ios#manual-linking) except that you will include the `node_modules/react-native-webview/macos/RNCWebView.xcodeproj` project in your main project and link the `RNCWebView-macOS.a` library.
62
-
63 57
 ### Windows:
64 58
 
65 59
 Autolinking is not yet supported for ReactNativeWindows. Make following additions to the given files manually:
@@ -77,7 +71,7 @@ Add the `ReactNativeWebView` project to your solution.
77 71
 Add a reference to `ReactNativeWebView` to your main application project. From Visual Studio 2019:
78 72
 
79 73
 1. Right-click main application project > Add > Reference...
80
-  Check `ReactNativeWebView` from Solution Projects.
74
+   Check `ReactNativeWebView` from Solution Projects.
81 75
 
82 76
 2. Modify files below to add the package providers to your main application project
83 77
 

+ 47
- 15
docs/Guide.md Zobrazit soubor

@@ -55,7 +55,11 @@ class MyWeb extends Component {
55 55
 
56 56
 ### Loading local HTML files
57 57
 
58
-Sometimes you would have bundled an HTML file along with the app and would like to load the HTML asset into your WebView. To do this on iOS, you can just import the html file like any other asset as shown below.
58
+Note: This is currently not working as discussed in [#428](https://github.com/react-native-community/react-native-webview/issues/428) and [#518](https://github.com/react-native-community/react-native-webview/issues/518). Possible workarounds include bundling all assets with webpack or similar, or running a [local webserver](https://github.com/futurepress/react-native-static-server).
59
+
60
+<details><summary>Show non-working method</summary>
61
+
62
+Sometimes you would have bundled an HTML file along with the app and would like to load the HTML asset into your WebView. To do this on iOS and Windows, you can just import the html file like any other asset as shown below.
59 63
 
60 64
 ```js
61 65
 import React, { Component } from 'react';
@@ -85,6 +89,8 @@ class MyWeb extends Component {
85 89
 }
86 90
 ```
87 91
 
92
+</details>
93
+
88 94
 ### Controlling navigation state changes
89 95
 
90 96
 Sometimes you want to intercept a user tapping on a link in your webview and do something different than navigating there in the webview. Here's some example code on how you might do that using the `onNavigationStateChange` function.
@@ -99,14 +105,14 @@ class MyWeb extends Component {
99 105
   render() {
100 106
     return (
101 107
       <WebView
102
-        ref={ref => (this.webview = ref)}
108
+        ref={(ref) => (this.webview = ref)}
103 109
         source={{ uri: 'https://reactnative.dev/' }}
104 110
         onNavigationStateChange={this.handleWebViewNavigationStateChange}
105 111
       />
106 112
     );
107 113
   }
108 114
 
109
-  handleWebViewNavigationStateChange = newNavState => {
115
+  handleWebViewNavigationStateChange = (newNavState) => {
110 116
     // newNavState looks something like this:
111 117
     // {
112 118
     //   url?: string;
@@ -226,9 +232,24 @@ You can control **single** or **multiple** file selection by specifing the [`mul
226 232
 
227 233
 ##### iOS
228 234
 
229
-For iOS, all you need to do is specify the permissions in your `ios/[project]/Info.plist` file:
235
+On iOS, you are going to have to supply your own code to download files. You can supply an `onFileDownload` callback
236
+to the WebView component as a prop. If RNCWebView determines that a file download needs to take place, the URL where you can download the file
237
+will be given to `onFileDownload`. From that callback you can then download that file however you would like to do so.
238
+
239
+NOTE: iOS 13+ is needed for the best possible download experience. On iOS 13 Apple added an API for accessing HTTP response headers, which
240
+is used to determine if an HTTP response should be a download. On iOS 12 or older, only MIME types that cannot be rendered by the webview will
241
+trigger calls to `onFileDownload`.
242
+
243
+Example:
244
+
245
+```javascript
246
+onFileDownload = ({ nativeEvent }) => {
247
+  const { downloadUrl } = nativeEvent;
248
+  // --> Your download code goes here <--
249
+};
250
+```
230 251
 
231
-Save to gallery:
252
+To be able to save images to the gallery you need to specify this permission in your `ios/[project]/Info.plist` file:
232 253
 
233 254
 ```
234 255
 <key>NSPhotoLibraryAddUsageDescription</key>
@@ -237,13 +258,14 @@ Save to gallery:
237 258
 
238 259
 ##### Android
239 260
 
240
-Add permission in AndroidManifest.xml:
261
+On Android, integration with the DownloadManager is built-in.
262
+Add this permisison in AndroidManifest.xml (only required if your app supports Android versions lower than 10):
241 263
 
242 264
 ```xml
243 265
 <manifest ...>
244 266
   ......
245 267
 
246
-  <!-- this is required to save files on Android  -->
268
+  <!-- this is required to save files on Android versions lower than 10 -->
247 269
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
248 270
 
249 271
   ......
@@ -283,6 +305,7 @@ export default class App extends Component {
283 305
             uri:
284 306
               'https://github.com/react-native-community/react-native-webview',
285 307
           }}
308
+          onMessage={(event) => {}}
286 309
           injectedJavaScript={runFirst}
287 310
         />
288 311
       </View>
@@ -291,9 +314,9 @@ export default class App extends Component {
291 314
 }
292 315
 ```
293 316
 
294
-This runs the JavaScript in the `runFirst` string once the page is loaded. In this case, you can see that both the body style was changed to red and the alert showed up after 2 seconds.
317
+This runs the JavaScript in the `runFirst` string once the page is loaded. In this case, you can see that both the body style was changed to red and the alert showed up after 2 seconds. An `onMessage` event is required as well to inject the JavaScript code into the WebView.
295 318
 
296
-By setting `injectedJavaScriptForMainFrameOnly: false`, the JavaScript injection will occur on all frames (not just the top frame) if supported for the given platform.
319
+By setting `injectedJavaScriptForMainFrameOnly: false`, the JavaScript injection will occur on all frames (not just the main frame) if supported for the given platform. For example, if a page contains an iframe, the javascript will be injected into that iframe as well with this set to `false`. (Note this is not supported on Android.) There is also `injectedJavaScriptBeforeContentLoadedForMainFrameOnly` for injecting prior to content loading. Read more about this in the [Reference](./Reference.md#injectedjavascriptformainframeonly).
297 320
 
298 321
 <img alt="screenshot of Github repo" width="200" src="https://user-images.githubusercontent.com/1479215/53609254-e5dc9c00-3b7a-11e9-9118-bc4e520ce6ca.png" />
299 322
 
@@ -334,10 +357,11 @@ export default class App extends Component {
334 357
 
335 358
 This runs the JavaScript in the `runFirst` string before the page is loaded. In this case, the value of `window.isNativeApp` will be set to true before the web code executes.
336 359
 
337
-By setting `injectedJavaScriptBeforeContentLoadedForMainFrameOnly: false`, the JavaScript injection will occur on all frames (not just the top frame) if supported for the given platform. Howver, although support for `injectedJavaScriptBeforeContentLoadedForMainFrameOnly: false` has been implemented for iOS and macOS, [it is not clear](https://github.com/react-native-community/react-native-webview/pull/1119#issuecomment-600275750) that it is actually possible to inject JS into iframes at this point in the page lifecycle, and so relying on the expected behaviour of this prop when set to `false` is not recommended.
360
+By setting `injectedJavaScriptBeforeContentLoadedForMainFrameOnly: false`, the JavaScript injection will occur on all frames (not just the top frame) if supported for the given platform. However, although support for `injectedJavaScriptBeforeContentLoadedForMainFrameOnly: false` has been implemented for iOS and macOS, [it is not clear](https://github.com/react-native-community/react-native-webview/pull/1119#issuecomment-600275750) that it is actually possible to inject JS into iframes at this point in the page lifecycle, and so relying on the expected behaviour of this prop when set to `false` is not recommended.
338 361
 
339 362
 > On iOS, ~~`injectedJavaScriptBeforeContentLoaded` runs a method on WebView called `evaluateJavaScript:completionHandler:`~~ – this is no longer true as of version `8.2.0`. Instead, we use a `WKUserScript` with injection time `WKUserScriptInjectionTimeAtDocumentStart`. As a consequence, `injectedJavaScriptBeforeContentLoaded` no longer returns an evaluation value nor logs a warning to the console. In the unlikely event that your app depended upon this behaviour, please see migration steps [here](https://github.com/react-native-community/react-native-webview/pull/1119#issuecomment-574919464) to retain equivalent behaviour.
340 363
 > On Android, `injectedJavaScript` runs a method on the Android WebView called `evaluateJavascriptWithFallback`
364
+> Note on Android Compatibility: For applications targeting `Build.VERSION_CODES.N` or later, JavaScript state from an empty WebView is no longer persisted across navigations like `loadUrl(java.lang.String)`. For example, global variables and functions defined before calling `loadUrl(java.lang.String)` will not exist in the loaded page. Applications should use the Android Native API `addJavascriptInterface(Object, String)` instead to persist JavaScript objects across navigations.
341 365
 
342 366
 #### The `injectJavaScript` method
343 367
 
@@ -362,7 +386,7 @@ export default class App extends Component {
362 386
     return (
363 387
       <View style={{ flex: 1 }}>
364 388
         <WebView
365
-          ref={r => (this.webref = r)}
389
+          ref={(r) => (this.webref = r)}
366 390
           source={{
367 391
             uri:
368 392
               'https://github.com/react-native-community/react-native-webview',
@@ -415,7 +439,7 @@ export default class App extends Component {
415 439
       <View style={{ flex: 1 }}>
416 440
         <WebView
417 441
           source={{ html }}
418
-          onMessage={event => {
442
+          onMessage={(event) => {
419 443
             alert(event.nativeEvent.data);
420 444
           }}
421 445
         />
@@ -451,7 +475,7 @@ This will set the header on the first load, but not on subsequent page navigatio
451 475
 In order to work around this, you can track the current URL, intercept new page loads, and navigate to them yourself ([original credit for this technique to Chirag Shah from Big Binary](https://blog.bigbinary.com/2016/07/26/passing-request-headers-on-each-webview-request-in-react-native.html)):
452 476
 
453 477
 ```jsx
454
-const CustomHeaderWebView = props => {
478
+const CustomHeaderWebView = (props) => {
455 479
   const { uri, onLoadStart, ...restProps } = props;
456 480
   const [currentURI, setURI] = useState(props.source.uri);
457 481
   const newSource = { ...props.source, uri: currentURI };
@@ -460,7 +484,7 @@ const CustomHeaderWebView = props => {
460 484
     <WebView
461 485
       {...restProps}
462 486
       source={newSource}
463
-      onShouldStartLoadWithRequest={request => {
487
+      onShouldStartLoadWithRequest={(request) => {
464 488
         // If we're loading the current URI, allow it to load
465 489
         if (request.url === currentURI) return true;
466 490
         // We're loading a new URL -- change state first
@@ -485,7 +509,7 @@ const CustomHeaderWebView = props => {
485 509
 
486 510
 You can set cookies on the React Native side using the [@react-native-community/cookies](https://github.com/react-native-community/cookies) package.
487 511
 
488
-When you do, you'll likely want to enable the [sharedCookiesEnabled](Reference#sharedCookiesEnabled) prop as well.
512
+When you do, you'll likely want to enable the [sharedCookiesEnabled](Reference.md#sharedCookiesEnabled) prop as well.
489 513
 
490 514
 ```jsx
491 515
 const App = () => {
@@ -517,3 +541,11 @@ const App = () => {
517 541
 ```
518 542
 
519 543
 Note that these cookies will only be sent on the first request unless you use the technique above for [setting custom headers on each page load](#Setting-Custom-Headers).
544
+
545
+### Hardware Silence Switch
546
+
547
+There are some inconsistencies in how the hardware silence switch is handled between embedded `audio` and `video` elements and between iOS and Android platforms.
548
+
549
+Audio on `iOS` will be muted when the hardware silence switch is in the on position, unless the `ignoreSilentHardwareSwitch` parameter is set to true.
550
+
551
+Video on `iOS` will always ignore the hardware silence switch.

+ 5
- 1
docs/README.portuguese.md Zobrazit soubor

@@ -19,6 +19,8 @@ _Esse projeto é mantido gratuitamente por essas pessoas usando ambos seu tempo
19 19
 
20 20
 - [x] iOS
21 21
 - [x] Android
22
+- [x] macOS
23
+- [x] Windows
22 24
 
23 25
 _Nota: O suporte da Expo para o React Native WebView começou com [Expo SDK v33.0.0](https://blog.expo.io/expo-sdk-v33-0-0-is-now-available-52d1c99dfe4c)._
24 26
 
@@ -34,7 +36,9 @@ Esse projeto segue [versionamento semântico](https://semver.org/). Não hesitam
34 36
 
35 37
 Versão atual: ![version](https://img.shields.io/npm/v/react-native-webview.svg)
36 38
 
37
-- [7.0.1](https://github.com/react-native-community/react-native-webview/releases/tag/v7.0.1) - UIWebView removido
39
+- [8.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v8.0.0) - onNavigationStateChange agora é disparado quando alterado o hash da URL.
40
+
41
+- [7.0.1](https://github.com/react-native-community/react-native-webview/releases/tag/v7.0.1) - UIWebView removido.
38 42
 
39 43
 - [6.0.**2**](https://github.com/react-native-community/react-native-webview/releases/tag/v6.0.2) - Update para AndroidX. Tenha certeza de habilitar no `android/gradle.properties` do seu projeto. Veja o [Getting Started Guide](https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md).
40 44
 

+ 226
- 81
docs/Reference.md Zobrazit soubor

@@ -13,6 +13,7 @@ This document lays out the current public properties and methods for the React N
13 13
 - [`mediaPlaybackRequiresUserAction`](Reference.md#mediaplaybackrequiresuseraction)
14 14
 - [`nativeConfig`](Reference.md#nativeconfig)
15 15
 - [`onError`](Reference.md#onerror)
16
+- [`onRenderProcessGone`](Reference.md#onRenderProcessGone)
16 17
 - [`onLoad`](Reference.md#onload)
17 18
 - [`onLoadEnd`](Reference.md#onloadend)
18 19
 - [`onLoadStart`](Reference.md#onloadstart)
@@ -32,7 +33,9 @@ This document lays out the current public properties and methods for the React N
32 33
 - [`decelerationRate`](Reference.md#decelerationrate)
33 34
 - [`domStorageEnabled`](Reference.md#domstorageenabled)
34 35
 - [`javaScriptEnabled`](Reference.md#javascriptenabled)
36
+- [`javaScriptCanOpenWindowsAutomatically`](Reference.md#javascriptcanopenwindowsautomatically)
35 37
 - [`androidHardwareAccelerationDisabled`](Reference.md#androidHardwareAccelerationDisabled)
38
+- [`androidLayerType`](Reference.md#androidLayerType)
36 39
 - [`mixedContentMode`](Reference.md#mixedcontentmode)
37 40
 - [`thirdPartyCookiesEnabled`](Reference.md#thirdpartycookiesenabled)
38 41
 - [`userAgent`](Reference.md#useragent)
@@ -43,6 +46,7 @@ This document lays out the current public properties and methods for the React N
43 46
 - [`overScrollMode`](Reference.md#overscrollmode)
44 47
 - [`contentInset`](Reference.md#contentinset)
45 48
 - [`contentInsetAdjustmentBehavior`](Reference.md#contentInsetAdjustmentBehavior)
49
+- [`contentMode`](Reference.md#contentMode)
46 50
 - [`dataDetectorTypes`](Reference.md#datadetectortypes)
47 51
 - [`scrollEnabled`](Reference.md#scrollenabled)
48 52
 - [`directionalLockEnabled`](Reference.md#directionalLockEnabled)
@@ -64,6 +68,9 @@ This document lays out the current public properties and methods for the React N
64 68
 - [`allowsLinkPreview`](Reference.md#allowsLinkPreview)
65 69
 - [`sharedCookiesEnabled`](Reference.md#sharedCookiesEnabled)
66 70
 - [`textZoom`](Reference.md#textZoom)
71
+- [`pullToRefreshEnabled`](Reference.md#pullToRefreshEnabled)
72
+- [`ignoreSilentHardwareSwitch`](Reference.md#ignoreSilentHardwareSwitch)
73
+- [`onFileDownload`](Reference.md#onFileDownload)
67 74
 
68 75
 ## Methods Index
69 76
 
@@ -77,6 +84,7 @@ This document lays out the current public properties and methods for the React N
77 84
 - [`clearCache`](Reference.md#clearCache)
78 85
 - [`clearHistory`](Reference.md#clearHistory)
79 86
 - [`requestFocus`](Reference.md#requestFocus)
87
+- [`postMessage`](Reference.md#postMessage)
80 88
 
81 89
 ---
82 90
 
@@ -84,7 +92,7 @@ This document lays out the current public properties and methods for the React N
84 92
 
85 93
 ## Props
86 94
 
87
-### `source`
95
+### `source`[⬆](#props-index)<!-- Link generated with jump2header -->
88 96
 
89 97
 Loads static HTML or a URI (with optional headers) in the WebView. Note that static HTML will require setting [`originWhitelist`](Reference.md#originwhitelist) to `["*"]`.
90 98
 
@@ -110,7 +118,7 @@ _Note that using static HTML requires the WebView property [originWhiteList](Ref
110 118
 
111 119
 ---
112 120
 
113
-### `automaticallyAdjustContentInsets`
121
+### `automaticallyAdjustContentInsets`[⬆](#props-index)<!-- Link generated with jump2header -->
114 122
 
115 123
 Controls whether to adjust the content inset for web views that are placed behind a navigation bar, tab bar, or toolbar. The default value is `true`.
116 124
 
@@ -120,7 +128,7 @@ Controls whether to adjust the content inset for web views that are placed behin
120 128
 
121 129
 ---
122 130
 
123
-### `injectedJavaScript`
131
+### `injectedJavaScript`[⬆](#props-index)<!-- Link generated with jump2header -->
124 132
 
125 133
 Set this to provide JavaScript that will be injected into the web page after the document finishes loading, but before other subresources finish loading.
126 134
 
@@ -152,7 +160,7 @@ const INJECTED_JAVASCRIPT = `(function() {
152 160
 
153 161
 ---
154 162
 
155
-### `injectedJavaScriptBeforeContentLoaded`
163
+### `injectedJavaScriptBeforeContentLoaded`[⬆](#props-index)<!-- Link generated with jump2header -->
156 164
 
157 165
 Set this to provide JavaScript that will be injected into the web page after the document element is created, but before other subresources finish loading.
158 166
 
@@ -184,33 +192,31 @@ const INJECTED_JAVASCRIPT = `(function() {
184 192
 
185 193
 ---
186 194
 
187
-### `injectedJavaScriptForMainFrameOnly`
195
+### `injectedJavaScriptForMainFrameOnly`[⬆](#props-index)<!-- Link generated with jump2header -->
188 196
 
189
-If `true` (default), loads the `injectedJavaScript` only into the main frame.
197
+If `true` (default; mandatory for Android), loads the `injectedJavaScript` only into the main frame.
190 198
 
191
-If `false`, loads it into all frames (e.g. iframes).
199
+If `false`, (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
192 200
 
193 201
 | Type   | Required | Platform |
194 202
 | ------ | -------- | -------- |
195
-| bool | No       | iOS, macOS       |
203
+| bool | No       | iOS and macOS (only `true` supported for Android) |
196 204
 
197 205
 ---
198 206
 
199
-### `injectedJavaScriptBeforeContentLoadedForMainFrameOnly`
207
+### `injectedJavaScriptBeforeContentLoadedForMainFrameOnly`[⬆](#props-index)<!-- Link generated with jump2header -->
200 208
 
201
-If `true` (default), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
209
+If `true` (default; mandatory for Android), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
202 210
 
203
-If `false`, loads it into all frames (e.g. iframes).
204
-
205
-Warning: although support for `injectedJavaScriptBeforeContentLoadedForMainFrameOnly: false` has been implemented for iOS and macOS, [it is not clear](https://github.com/react-native-community/react-native-webview/pull/1119#issuecomment-600275750) that it is actually possible to inject JS into iframes at this point in the page lifecycle, and so relying on the expected behaviour of this prop when set to `false` is not recommended.
211
+If `false`, (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
206 212
 
207 213
 | Type   | Required | Platform |
208 214
 | ------ | -------- | -------- |
209
-| bool | No       | iOS, macOS       |
215
+| bool | No       | iOS and macOS (only `true` supported for Android) |
210 216
 
211 217
 ---
212 218
 
213
-### `mediaPlaybackRequiresUserAction`
219
+### `mediaPlaybackRequiresUserAction`[⬆](#props-index)<!-- Link generated with jump2header -->
214 220
 
215 221
 Boolean that determines whether HTML5 audio and video requires the user to tap them before they start playing. The default value is `true`. (Android API minimum version 17).
216 222
 
@@ -222,7 +228,7 @@ NOTE: the default `true` value might cause some videos to hang loading on iOS. S
222 228
 
223 229
 ---
224 230
 
225
-### `nativeConfig`
231
+### `nativeConfig`[⬆](#props-index)<!-- Link generated with jump2header -->
226 232
 
227 233
 Override the native component used to render the WebView. Enables a custom native WebView which uses the same JavaScript as the original WebView.
228 234
 
@@ -238,7 +244,7 @@ The `nativeConfig` prop expects an object with the following keys:
238 244
 
239 245
 ---
240 246
 
241
-### `onError`
247
+### `onError`[⬆](#props-index)<!-- Link generated with jump2header -->
242 248
 
243 249
 Function that is invoked when the `WebView` load fails.
244 250
 
@@ -278,7 +284,7 @@ url
278 284
 
279 285
 ---
280 286
 
281
-### `onLoad`
287
+### `onLoad`[⬆](#props-index)<!-- Link generated with jump2header -->
282 288
 
283 289
 Function that is invoked when the `WebView` has finished loading.
284 290
 
@@ -311,7 +317,7 @@ url
311 317
 
312 318
 ---
313 319
 
314
-### `onLoadEnd`
320
+### `onLoadEnd`[⬆](#props-index)<!-- Link generated with jump2header -->
315 321
 
316 322
 Function that is invoked when the `WebView` load succeeds or fails.
317 323
 
@@ -345,7 +351,7 @@ url
345 351
 
346 352
 ---
347 353
 
348
-### `onLoadStart`
354
+### `onLoadStart`[⬆](#props-index)<!-- Link generated with jump2header -->
349 355
 
350 356
 Function that is invoked when the `WebView` starts loading.
351 357
 
@@ -379,7 +385,7 @@ url
379 385
 
380 386
 ---
381 387
 
382
-### `onLoadProgress`
388
+### `onLoadProgress`[⬆](#props-index)<!-- Link generated with jump2header -->
383 389
 
384 390
 Function that is invoked when the `WebView` is loading.
385 391
 
@@ -412,7 +418,7 @@ url
412 418
 
413 419
 ---
414 420
 
415
-### `onHttpError`
421
+### `onHttpError`[⬆](#props-index)<!-- Link generated with jump2header -->
416 422
 
417 423
 Function that is invoked when the `WebView` receives an http error.
418 424
 
@@ -456,7 +462,40 @@ url
456 462
 
457 463
 ---
458 464
 
459
-### `onMessage`
465
+### `onRenderProcessGone`[⬆](#props-index)<!-- Link generated with jump2header -->
466
+
467
+Function that is invoked when the `WebView` process crashes or is killed by the OS on Android.
468
+
469
+> **_Note_**
470
+> Android API minimum level 26. Android Only
471
+
472
+| Type     | Required |
473
+| -------- | -------- |
474
+| function | No       |
475
+
476
+Example:
477
+
478
+```jsx
479
+<WebView
480
+  source={{ uri: 'https://reactnative.dev' }}
481
+  onRenderProcessGone={syntheticEvent => {
482
+    const { nativeEvent } = syntheticEvent;
483
+    console.warn(
484
+      'WebView Crashed: ',
485
+      nativeEvent.didCrash,
486
+    );
487
+  }}
488
+/>
489
+```
490
+
491
+Function passed to `onRenderProcessGone` is called with a SyntheticEvent wrapping a nativeEvent with these properties:
492
+
493
+```
494
+didCrash
495
+```
496
+---
497
+
498
+### `onMessage`[⬆](#props-index)<!-- Link generated with jump2header -->
460 499
 
461 500
 Function that is invoked when the webview calls `window.ReactNativeWebView.postMessage`. Setting this property will inject this global into your webview.
462 501
 
@@ -470,7 +509,7 @@ To learn more, read the [Communicating between JS and Native](Guide.md#communica
470 509
 
471 510
 ---
472 511
 
473
-### `onNavigationStateChange`
512
+### `onNavigationStateChange`[⬆](#props-index)<!-- Link generated with jump2header -->
474 513
 
475 514
 Function that is invoked when the `WebView` loading starts or ends.
476 515
 
@@ -506,7 +545,7 @@ Note that this method will not be invoked on hash URL changes (e.g. from `https:
506 545
 
507 546
 ---
508 547
 
509
-### `onContentProcessDidTerminate`
548
+### `onContentProcessDidTerminate`[⬆](#props-index)<!-- Link generated with jump2header -->
510 549
 
511 550
 Function that is invoked when the `WebView` content process is terminated.
512 551
 
@@ -540,7 +579,7 @@ url
540 579
 
541 580
 ---
542 581
 
543
-### `originWhitelist`
582
+### `originWhitelist`[⬆](#props-index)<!-- Link generated with jump2header -->
544 583
 
545 584
 List of origin strings to allow being navigated to. The strings allow wildcards and get matched against _just_ the origin (not the full URL). If the user taps to navigate to a new page but the new page is not in this whitelist, the URL will be handled by the OS. The default whitelisted origins are "http://*" and "https://*".
546 585
 
@@ -560,7 +599,7 @@ Example:
560 599
 
561 600
 ---
562 601
 
563
-### `renderError`
602
+### `renderError`[⬆](#props-index)<!-- Link generated with jump2header -->
564 603
 
565 604
 Function that returns a view to show if there's an error.
566 605
 
@@ -581,7 +620,7 @@ The function passed to `renderError` will be called with the name of the error
581 620
 
582 621
 ---
583 622
 
584
-### `renderLoading`
623
+### `renderLoading`[⬆](#props-index)<!-- Link generated with jump2header -->
585 624
 
586 625
 Function that returns a loading indicator. The startInLoadingState prop must be set to true in order to use this prop.
587 626
 
@@ -601,7 +640,7 @@ Example:
601 640
 
602 641
 ---
603 642
 
604
-### `scalesPageToFit`
643
+### `scalesPageToFit`[⬆](#props-index)<!-- Link generated with jump2header -->
605 644
 
606 645
 Boolean that controls whether the web content is scaled to fit the view and enables the user to change the scale. The default value is `true`.
607 646
 
@@ -611,7 +650,7 @@ Boolean that controls whether the web content is scaled to fit the view and enab
611 650
 
612 651
 ---
613 652
 
614
-### `onShouldStartLoadWithRequest`
653
+### `onShouldStartLoadWithRequest`[⬆](#props-index)<!-- Link generated with jump2header -->
615 654
 
616 655
 Function that allows custom handling of any web view requests. Return `true` from the function to continue loading the request and `false` to stop loading.
617 656
 
@@ -645,11 +684,12 @@ canGoForward
645 684
 lockIdentifier
646 685
 mainDocumentURL (iOS only)
647 686
 navigationType
687
+isTopFrame
648 688
 ```
649 689
 
650 690
 ---
651 691
 
652
-### `startInLoadingState`
692
+### `startInLoadingState`[⬆](#props-index)<!-- Link generated with jump2header -->
653 693
 
654 694
 Boolean value that forces the `WebView` to show the loading view on the first load. This prop must be set to `true` in order for the `renderLoading` prop to work.
655 695
 
@@ -659,7 +699,7 @@ Boolean value that forces the `WebView` to show the loading view on the first lo
659 699
 
660 700
 ---
661 701
 
662
-### `style`
702
+### `style`[⬆](#props-index)<!-- Link generated with jump2header -->
663 703
 
664 704
 A style object that allow you to customize the `WebView` style. Please note that there are default styles (example: you need to add `flex: 0` to the style if you want to use `height` property).
665 705
 
@@ -678,7 +718,7 @@ Example:
678 718
 
679 719
 ---
680 720
 
681
-### `containerStyle`
721
+### `containerStyle`[⬆](#props-index)<!-- Link generated with jump2header -->
682 722
 
683 723
 A style object that allow you to customize the `WebView` container style. Please note that there are default styles (example: you need to add `flex: 0` to the style if you want to use `height` property).
684 724
 
@@ -697,7 +737,7 @@ Example:
697 737
 
698 738
 ---
699 739
 
700
-### `decelerationRate`
740
+### `decelerationRate`[⬆](#props-index)<!-- Link generated with jump2header -->
701 741
 
702 742
 A floating-point number that determines how quickly the scroll view decelerates after the user lifts their finger. You may also use the string shortcuts `"normal"` and `"fast"` which match the underlying iOS settings for `UIScrollViewDecelerationRateNormal` and `UIScrollViewDecelerationRateFast` respectively:
703 743
 
@@ -710,7 +750,7 @@ A floating-point number that determines how quickly the scroll view decelerates
710 750
 
711 751
 ---
712 752
 
713
-### `domStorageEnabled`
753
+### `domStorageEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
714 754
 
715 755
 Boolean value to control whether DOM Storage is enabled. Used only in Android.
716 756
 
@@ -720,7 +760,7 @@ Boolean value to control whether DOM Storage is enabled. Used only in Android.
720 760
 
721 761
 ---
722 762
 
723
-### `javaScriptEnabled`
763
+### `javaScriptEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
724 764
 
725 765
 Boolean value to enable JavaScript in the `WebView`. The default value is `true`.
726 766
 
@@ -730,9 +770,19 @@ Boolean value to enable JavaScript in the `WebView`. The default value is `true`
730 770
 
731 771
 ---
732 772
 
733
-### `androidHardwareAccelerationDisabled`
773
+### `javaScriptCanOpenWindowsAutomatically`[⬆](#props-index)<!-- Link generated with jump2header -->
774
+
775
+A Boolean value indicating whether JavaScript can open windows without user interaction. The default value is `false`.
776
+
777
+| Type | Required |
778
+| ---- | -------- |
779
+| bool | No       |
780
+
781
+---
782
+
783
+### `androidHardwareAccelerationDisabled`[⬆](#props-index)<!-- Link generated with jump2header -->
734 784
 
735
-Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android only as Hardware Acceleration is a feature only for Android. The default value is `false`.
785
+**Deprecated.** Use the `androidLayerType` prop instead. 
736 786
 
737 787
 | Type | Required | Platform |
738 788
 | ---- | -------- | -------- |
@@ -740,7 +790,25 @@ Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android
740 790
 
741 791
 ---
742 792
 
743
-### `mixedContentMode`
793
+### `androidLayerType`[⬆](#props-index)<!-- Link generated with jump2header -->
794
+
795
+Specifies the layer type. 
796
+
797
+Possible values for `androidLayerType` are:
798
+
799
+- `none` (default) - The view does not have a layer.
800
+- `software` - The view has a software layer. A software layer is backed by a bitmap and causes the view to be rendered using Android's software rendering pipeline, even if hardware acceleration is enabled.
801
+- `hardware` - The view has a hardware layer. A hardware layer is backed by a hardware specific texture and causes the view to be rendered using Android's hardware rendering pipeline, but only if hardware acceleration is turned on for the view hierarchy.
802
+
803
+Avoid setting both `androidLayerType` and `androidHardwareAccelerationDisabled` props at the same time, as this may cause undefined behaviour.
804
+
805
+| Type   | Required | Platform |
806
+| ------ | -------- | -------- |
807
+| string | No       | Android  |
808
+
809
+---
810
+
811
+### `mixedContentMode`[⬆](#props-index)<!-- Link generated with jump2header -->
744 812
 
745 813
 Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin.
746 814
 
@@ -756,7 +824,7 @@ Possible values for `mixedContentMode` are:
756 824
 
757 825
 ---
758 826
 
759
-### `thirdPartyCookiesEnabled`
827
+### `thirdPartyCookiesEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
760 828
 
761 829
 Boolean value to enable third party cookies in the `WebView`. Used on Android Lollipop and above only as third party cookies are enabled by default on Android Kitkat and below and on iOS. The default value is `true`. For more on cookies, read the [Guide](Guide.md#Managing-Cookies)
762 830
 
@@ -766,7 +834,7 @@ Boolean value to enable third party cookies in the `WebView`. Used on Android Lo
766 834
 
767 835
 ---
768 836
 
769
-### `userAgent`
837
+### `userAgent`[⬆](#props-index)<!-- Link generated with jump2header -->
770 838
 
771 839
 Sets the user-agent for the `WebView`.
772 840
 
@@ -776,7 +844,7 @@ Sets the user-agent for the `WebView`.
776 844
 
777 845
 ---
778 846
 
779
-### `applicationNameForUserAgent`
847
+### `applicationNameForUserAgent`[⬆](#props-index)<!-- Link generated with jump2header -->
780 848
 
781 849
 Append to the existing user-agent. Setting `userAgent` will override this.
782 850
 
@@ -794,7 +862,7 @@ Append to the existing user-agent. Setting `userAgent` will override this.
794 862
 // Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 DemoApp/1.1.0
795 863
 ```
796 864
 
797
-### `allowsFullscreenVideo`
865
+### `allowsFullscreenVideo`[⬆](#props-index)<!-- Link generated with jump2header -->
798 866
 
799 867
 Boolean that determines whether videos are allowed to be played in fullscreen. The default value is `false`.
800 868
 
@@ -804,7 +872,7 @@ Boolean that determines whether videos are allowed to be played in fullscreen. T
804 872
 
805 873
 ---
806 874
 
807
-### `allowsInlineMediaPlayback`
875
+### `allowsInlineMediaPlayback`[⬆](#props-index)<!-- Link generated with jump2header -->
808 876
 
809 877
 Boolean that determines whether HTML5 videos play inline or use the native full-screen controller. The default value is `false`.
810 878
 
@@ -818,7 +886,7 @@ Boolean that determines whether HTML5 videos play inline or use the native full-
818 886
 
819 887
 ---
820 888
 
821
-### `bounces`
889
+### `bounces`[⬆](#props-index)<!-- Link generated with jump2header -->
822 890
 
823 891
 Boolean value that determines whether the web view bounces when it reaches the edge of the content. The default value is `true`.
824 892
 
@@ -828,7 +896,7 @@ Boolean value that determines whether the web view bounces when it reaches the e
828 896
 
829 897
 ---
830 898
 
831
-### `overScrollMode`
899
+### `overScrollMode`[⬆](#props-index)<!-- Link generated with jump2header -->
832 900
 
833 901
 Specifies the over scroll mode.
834 902
 
@@ -844,7 +912,7 @@ Possible values for `overScrollMode` are:
844 912
 
845 913
 ---
846 914
 
847
-### `contentInset`
915
+### `contentInset`[⬆](#props-index)<!-- Link generated with jump2header -->
848 916
 
849 917
 The amount by which the web view content is inset from the edges of the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
850 918
 
@@ -854,7 +922,7 @@ The amount by which the web view content is inset from the edges of the scroll v
854 922
 
855 923
 ---
856 924
 
857
-### `contentInsetAdjustmentBehavior`
925
+### `contentInsetAdjustmentBehavior`[⬆](#props-index)<!-- Link generated with jump2header -->
858 926
 
859 927
 This property specifies how the safe area insets are used to modify the content area of the scroll view. The default value of this property is "never". Available on iOS 11 and later. Defaults to `never`.
860 928
 
@@ -871,7 +939,25 @@ Possible values:
871 939
 
872 940
 ---
873 941
 
874
-### `dataDetectorTypes`
942
+### `contentMode`[⬆](#props-index)<!-- Link generated with jump2header -->
943
+
944
+Controls the type of content to load. Available on iOS 13 and later. Defaults to `recommended`, which loads mobile content on iPhone & iPad Mini but desktop content on larger iPads.
945
+
946
+See [Introducing Desktop-class Browsing on iPad](https://developer.apple.com/videos/play/wwdc2019/203/) for more.
947
+
948
+Possible values:
949
+
950
+- `recommended`
951
+- `mobile`
952
+- `desktop`
953
+
954
+| Type   | Required | Platform |
955
+| ------ | -------- | -------- |
956
+| string | No       | iOS      |
957
+
958
+---
959
+
960
+### `dataDetectorTypes`[⬆](#props-index)<!-- Link generated with jump2header -->
875 961
 
876 962
 Determines the types of data converted to clickable URLs in the web view's content. By default only phone numbers are detected.
877 963
 
@@ -895,7 +981,7 @@ Possible values for `dataDetectorTypes` are:
895 981
 
896 982
 ---
897 983
 
898
-### `scrollEnabled`
984
+### `scrollEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
899 985
 
900 986
 Boolean value that determines whether scrolling is enabled in the `WebView`. The default value is `true`. Setting this to `false` will prevent the webview from moving the document body when the keyboard appears over an input.
901 987
 
@@ -905,7 +991,7 @@ Boolean value that determines whether scrolling is enabled in the `WebView`. The
905 991
 
906 992
 ---
907 993
 
908
-### `directionalLockEnabled`
994
+### `directionalLockEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
909 995
 
910 996
 A Boolean value that determines whether scrolling is disabled in a particular direction.
911 997
 The default value is `true`.
@@ -916,7 +1002,7 @@ The default value is `true`.
916 1002
 
917 1003
 ---
918 1004
 
919
-### `showsHorizontalScrollIndicator`
1005
+### `showsHorizontalScrollIndicator`[⬆](#props-index)<!-- Link generated with jump2header -->
920 1006
 
921 1007
 Boolean value that determines whether a horizontal scroll indicator is shown in the `WebView`. The default value is `true`.
922 1008
 
@@ -926,7 +1012,7 @@ Boolean value that determines whether a horizontal scroll indicator is shown in
926 1012
 
927 1013
 ---
928 1014
 
929
-### `showsVerticalScrollIndicator`
1015
+### `showsVerticalScrollIndicator`[⬆](#props-index)<!-- Link generated with jump2header -->
930 1016
 
931 1017
 Boolean value that determines whether a vertical scroll indicator is shown in the `WebView`. The default value is `true`.
932 1018
 
@@ -936,7 +1022,7 @@ Boolean value that determines whether a vertical scroll indicator is shown in th
936 1022
 
937 1023
 ---
938 1024
 
939
-### `geolocationEnabled`
1025
+### `geolocationEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
940 1026
 
941 1027
 Set whether Geolocation is enabled in the `WebView`. The default value is `false`. Used only in Android.
942 1028
 
@@ -946,7 +1032,7 @@ Set whether Geolocation is enabled in the `WebView`. The default value is `false
946 1032
 
947 1033
 ---
948 1034
 
949
-### `allowFileAccessFromFileURLs`
1035
+### `allowFileAccessFromFileURLs`[⬆](#props-index)<!-- Link generated with jump2header -->
950 1036
 
951 1037
 Boolean that sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from other file scheme URLs. The default value is `false`.
952 1038
 
@@ -956,7 +1042,7 @@ Boolean that sets whether JavaScript running in the context of a file scheme URL
956 1042
 
957 1043
 ---
958 1044
 
959
-### `allowUniversalAccessFromFileURLs`
1045
+### `allowUniversalAccessFromFileURLs`[⬆](#props-index)<!-- Link generated with jump2header -->
960 1046
 
961 1047
 Boolean that sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin. Including accessing content from other file scheme URLs. The default value is `false`.
962 1048
 
@@ -966,7 +1052,7 @@ Boolean that sets whether JavaScript running in the context of a file scheme URL
966 1052
 
967 1053
 ---
968 1054
 
969
-### `allowingReadAccessToURL`
1055
+### `allowingReadAccessToURL`[⬆](#props-index)<!-- Link generated with jump2header -->
970 1056
 
971 1057
 A String value that indicates which URLs the WebView's file can then reference in scripts, AJAX requests, and CSS imports. This is only used in for WebViews that are loaded with a source.uri set to a `'file://'` URL. If not provided, the default is to only allow read access to the URL provided in source.uri itself.
972 1058
 
@@ -976,7 +1062,7 @@ A String value that indicates which URLs the WebView's file can then reference i
976 1062
 
977 1063
 ---
978 1064
 
979
-### `url`
1065
+### `url`[⬆](#props-index)<!-- Link generated with jump2header -->
980 1066
 
981 1067
 **Deprecated.** Use the `source` prop instead.
982 1068
 
@@ -986,7 +1072,7 @@ A String value that indicates which URLs the WebView's file can then reference i
986 1072
 
987 1073
 ---
988 1074
 
989
-### `html`
1075
+### `html`[⬆](#props-index)<!-- Link generated with jump2header -->
990 1076
 
991 1077
 **Deprecated.** Use the `source` prop instead.
992 1078
 
@@ -996,7 +1082,7 @@ A String value that indicates which URLs the WebView's file can then reference i
996 1082
 
997 1083
 ---
998 1084
 
999
-### `keyboardDisplayRequiresUserAction`
1085
+### `keyboardDisplayRequiresUserAction`[⬆](#props-index)<!-- Link generated with jump2header -->
1000 1086
 
1001 1087
 If false, web content can programmatically display the keyboard. The default value is `true`.
1002 1088
 
@@ -1006,7 +1092,7 @@ If false, web content can programmatically display the keyboard. The default val
1006 1092
 
1007 1093
 ---
1008 1094
 
1009
-### `hideKeyboardAccessoryView`
1095
+### `hideKeyboardAccessoryView`[⬆](#props-index)<!-- Link generated with jump2header -->
1010 1096
 
1011 1097
 If true, this will hide the keyboard accessory view (< > and Done).
1012 1098
 
@@ -1016,7 +1102,7 @@ If true, this will hide the keyboard accessory view (< > and Done).
1016 1102
 
1017 1103
 ---
1018 1104
 
1019
-### `allowsBackForwardNavigationGestures`
1105
+### `allowsBackForwardNavigationGestures`[⬆](#props-index)<!-- Link generated with jump2header -->
1020 1106
 
1021 1107
 If true, this will be able horizontal swipe gestures. The default value is `false`.
1022 1108
 
@@ -1026,7 +1112,7 @@ If true, this will be able horizontal swipe gestures. The default value is `fals
1026 1112
 
1027 1113
 ---
1028 1114
 
1029
-### `incognito`
1115
+### `incognito`[⬆](#props-index)<!-- Link generated with jump2header -->
1030 1116
 
1031 1117
 Does not store any data within the lifetime of the WebView.
1032 1118
 
@@ -1036,7 +1122,7 @@ Does not store any data within the lifetime of the WebView.
1036 1122
 
1037 1123
 ---
1038 1124
 
1039
-### `allowFileAccess`
1125
+### `allowFileAccess`[⬆](#props-index)<!-- Link generated with jump2header -->
1040 1126
 
1041 1127
 If true, this will allow access to the file system via `file://` URI's. The default value is `false`.
1042 1128
 
@@ -1046,7 +1132,7 @@ If true, this will allow access to the file system via `file://` URI's. The defa
1046 1132
 
1047 1133
 ---
1048 1134
 
1049
-### `saveFormDataDisabled`
1135
+### `saveFormDataDisabled`[⬆](#props-index)<!-- Link generated with jump2header -->
1050 1136
 
1051 1137
 Sets whether the WebView should disable saving form data. The default value is `false`. This function does not have any effect from Android API level 26 onwards as there is an Autofill feature which stores form data.
1052 1138
 
@@ -1056,7 +1142,7 @@ Sets whether the WebView should disable saving form data. The default value is `
1056 1142
 
1057 1143
 ---
1058 1144
 
1059
-### `cacheEnabled`
1145
+### `cacheEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
1060 1146
 
1061 1147
 Sets whether WebView should use browser caching.
1062 1148
 
@@ -1066,7 +1152,7 @@ Sets whether WebView should use browser caching.
1066 1152
 
1067 1153
 ---
1068 1154
 
1069
-### `cacheMode`
1155
+### `cacheMode`[⬆](#props-index)<!-- Link generated with jump2header -->
1070 1156
 
1071 1157
 Overrides the way the cache is used. The way the cache is used is based on the navigation type. For a normal page load, the cache is checked and content is re-validated as needed. When navigating back, content is not revalidated, instead the content is just retrieved from the cache. This property allows the client to override this behavior.
1072 1158
 
@@ -1083,7 +1169,7 @@ Possible values are:
1083 1169
 
1084 1170
 ---
1085 1171
 
1086
-### `pagingEnabled`
1172
+### `pagingEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
1087 1173
 
1088 1174
 If the value of this property is true, the scroll view stops on multiples of the scroll view’s bounds when the user scrolls. The default value is false.
1089 1175
 
@@ -1093,7 +1179,7 @@ If the value of this property is true, the scroll view stops on multiples of the
1093 1179
 
1094 1180
 ---
1095 1181
 
1096
-### `allowsLinkPreview`
1182
+### `allowsLinkPreview`[⬆](#props-index)<!-- Link generated with jump2header -->
1097 1183
 
1098 1184
 A Boolean value that determines whether pressing on a link displays a preview of the destination for the link. In iOS this property is available on devices that support 3D Touch. In iOS 10 and later, the default value is true; before that, the default value is false.
1099 1185
 
@@ -1103,7 +1189,7 @@ A Boolean value that determines whether pressing on a link displays a preview of
1103 1189
 
1104 1190
 ---
1105 1191
 
1106
-### `sharedCookiesEnabled`
1192
+### `sharedCookiesEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
1107 1193
 
1108 1194
 Set `true` if shared cookies from `[NSHTTPCookieStorage sharedHTTPCookieStorage]` should used for every load request in the WebView. The default value is `false`. For more on cookies, read the [Guide](Guide.md#Managing-Cookies)
1109 1195
 
@@ -1113,7 +1199,7 @@ Set `true` if shared cookies from `[NSHTTPCookieStorage sharedHTTPCookieStorage]
1113 1199
 
1114 1200
 ---
1115 1201
 
1116
-### `textZoom`
1202
+### `textZoom`[⬆](#props-index)<!-- Link generated with jump2header -->
1117 1203
 
1118 1204
 If the user has set a custom font size in the Android system, an undesirable scale of the site interface in WebView occurs.
1119 1205
 
@@ -1127,15 +1213,67 @@ Example:
1127 1213
 
1128 1214
 `<WebView textZoom={100} />`
1129 1215
 
1216
+---
1217
+
1218
+### `pullToRefreshEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
1219
+
1220
+Boolean value that determines whether a pull to refresh gesture is available in the `WebView`. The default value is `false`. If `true`, sets `bounces` automatically to `true`.
1221
+
1222
+| Type    | Required | Platform |
1223
+| ------- | -------- | -------- |
1224
+| boolean | No       | iOS      |
1225
+
1226
+### `ignoreSilentHardwareSwitch`[⬆](#props-index)<!-- Link generated with jump2header -->
1227
+
1228
+(ios only)
1229
+
1230
+When set to true the hardware silent switch is ignored. Default: `false`
1231
+
1232
+| Type    | Required | Platform |
1233
+| ------- | -------- | -------- |
1234
+| boolean | No       | iOS      |
1235
+
1236
+### `onFileDownload`[⬆](#props-index)<!-- Link generated with jump2header -->
1237
+This property is iOS-only.
1238
+
1239
+Function that is invoked when the client needs to download a file.
1240
+
1241
+iOS 13+ only: If the webview navigates to a URL that results in an HTTP
1242
+response with a Content-Disposition header 'attachment...', then
1243
+this will be called.
1244
+
1245
+iOS 8+: If the MIME type indicates that the content is not renderable by the
1246
+webview, that will also cause this to be called. On iOS versions before 13,
1247
+this is the only condition that will cause this function to be called.
1248
+
1249
+The application will need to provide its own code to actually download
1250
+the file.
1251
+
1252
+If not provided, the default is to let the webview try to render the file.
1253
+
1254
+Example:
1255
+```jsx
1256
+<WebView
1257
+  source={{ uri: 'https://reactnative.dev' }}
1258
+  onFileDownload={ ( { nativeEvent: { downloadUrl } } ) => {
1259
+    // You use downloadUrl which is a string to download files however you want.
1260
+  }}
1261
+  />
1262
+```
1263
+
1264
+| Type    | Required | Platform |
1265
+| ------- | -------- | -------- |
1266
+| function | No       | iOS      |
1267
+
1130 1268
 ## Methods
1131 1269
 
1132
-### `extraNativeComponentConfig()`
1270
+### `extraNativeComponentConfig()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1133 1271
 
1134 1272
 ```javascript
1135 1273
 static extraNativeComponentConfig()
1136 1274
 ```
1137 1275
 
1138
-### `goForward()`
1276
+### `goForward()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1139 1277
 
1140 1278
 ```javascript
1141 1279
 goForward();
@@ -1143,7 +1281,7 @@ goForward();
1143 1281
 
1144 1282
 Go forward one page in the web view's history.
1145 1283
 
1146
-### `goBack()`
1284
+### `goBack()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1147 1285
 
1148 1286
 ```javascript
1149 1287
 goBack();
@@ -1151,7 +1289,7 @@ goBack();
1151 1289
 
1152 1290
 Go back one page in the web view's history.
1153 1291
 
1154
-### `reload()`
1292
+### `reload()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1155 1293
 
1156 1294
 ```javascript
1157 1295
 reload();
@@ -1159,7 +1297,7 @@ reload();
1159 1297
 
1160 1298
 Reloads the current page.
1161 1299
 
1162
-### `stopLoading()`
1300
+### `stopLoading()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1163 1301
 
1164 1302
 ```javascript
1165 1303
 stopLoading();
@@ -1167,7 +1305,7 @@ stopLoading();
1167 1305
 
1168 1306
 Stop loading the current page.
1169 1307
 
1170
-### `injectJavaScript(str)`
1308
+### `injectJavaScript(str)`[⬆](#methods-index)<!-- Link generated with jump2header -->
1171 1309
 
1172 1310
 ```javascript
1173 1311
 injectJavaScript('... javascript string ...');
@@ -1177,7 +1315,7 @@ Executes the JavaScript string.
1177 1315
 
1178 1316
 To learn more, read the [Communicating between JS and Native](Guide.md#communicating-between-js-and-native) guide.
1179 1317
 
1180
-### `requestFocus()`
1318
+### `requestFocus()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1181 1319
 
1182 1320
 ```javascript
1183 1321
 requestFocus();
@@ -1185,7 +1323,14 @@ requestFocus();
1185 1323
 
1186 1324
 Request the webView to ask for focus. (People working on TV apps might want having a look at this!)
1187 1325
 
1188
-### `clearFormData()`
1326
+### `postMessage(str)`[⬆](#methods-index)<!-- Link generated with jump2header -->
1327
+
1328
+```javascript
1329
+postMessage('message');
1330
+```
1331
+Post a message to WebView, handled by [`onMessage`](Reference.md#onmessage).
1332
+
1333
+### `clearFormData()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1189 1334
 
1190 1335
 (android only)
1191 1336
 
@@ -1195,7 +1340,7 @@ clearFormData();
1195 1340
 
1196 1341
 Removes the autocomplete popup from the currently focused form field, if present. [developer.android.com reference](<https://developer.android.com/reference/android/webkit/WebView.html#clearFormData()>)
1197 1342
 
1198
-### `clearCache(bool)`
1343
+### `clearCache(bool)`[⬆](#methods-index)<!-- Link generated with jump2header -->
1199 1344
 
1200 1345
 (android only)
1201 1346
 
@@ -1205,7 +1350,7 @@ clearCache(true);
1205 1350
 
1206 1351
 Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used. [developer.android.com reference](<https://developer.android.com/reference/android/webkit/WebView.html#clearCache(boolean)>)
1207 1352
 
1208
-### `clearHistory()`
1353
+### `clearHistory()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1209 1354
 
1210 1355
 (android only)
1211 1356
 

+ 28
- 0
example/App.tsx Zobrazit soubor

@@ -13,8 +13,10 @@ import {
13 13
 import Alerts from './examples/Alerts';
14 14
 import Scrolling from './examples/Scrolling';
15 15
 import Background from './examples/Background';
16
+import Downloads from './examples/Downloads';
16 17
 import Uploads from './examples/Uploads';
17 18
 import Injection from './examples/Injection';
19
+import LocalPageLoad from './examples/LocalPageLoad';
18 20
 
19 21
 const TESTS = {
20 22
   Alerts: {
@@ -41,6 +43,14 @@ const TESTS = {
41 43
       return <Background />;
42 44
     },
43 45
   },
46
+  Downloads: {
47
+    title: 'Downloads',
48
+    testId: 'downloads',
49
+    description: 'File downloads test',
50
+    render() {
51
+      return <Downloads />;
52
+    },
53
+  },
44 54
   Uploads: {
45 55
     title: 'Uploads',
46 56
     testId: 'uploads',
@@ -57,6 +67,14 @@ const TESTS = {
57 67
       return <Injection />;
58 68
     },
59 69
   },
70
+  PageLoad: {
71
+    title: 'LocalPageLoad',
72
+    testId: 'LocalPageLoad',
73
+    description: 'Local Page load test',
74
+    render() {
75
+      return <LocalPageLoad />;
76
+    },
77
+  },
60 78
 };
61 79
 
62 80
 type Props = {};
@@ -115,6 +133,16 @@ export default class App extends Component<Props, State> {
115 133
             title="Injection"
116 134
             onPress={() => this._changeTest('Injection')}
117 135
           />
136
+          <Button
137
+            testID="testType_pageLoad"
138
+            title="LocalPageLoad"
139
+            onPress={() => this._changeTest('PageLoad')}
140
+          />
141
+          {Platform.OS == "ios" && <Button
142
+            testID="testType_downloads"
143
+            title="Downloads"
144
+            onPress={() => this._changeTest('Downloads')}
145
+          />}
118 146
           {Platform.OS === 'android' && <Button
119 147
             testID="testType_uploads"
120 148
             title="Uploads"

+ 7
- 0
example/android/app/src/main/java/com/example/MainApplication.java Zobrazit soubor

@@ -2,6 +2,9 @@ package com.example;
2 2
 
3 3
 import android.app.Application;
4 4
 import android.content.Context;
5
+import android.os.Build;
6
+import android.webkit.WebView;
7
+
5 8
 import com.facebook.react.PackageList;
6 9
 import com.facebook.react.ReactApplication;
7 10
 import com.facebook.react.ReactNativeHost;
@@ -44,6 +47,10 @@ public class MainApplication extends Application implements ReactApplication {
44 47
   @Override
45 48
   public void onCreate() {
46 49
     super.onCreate();
50
+    /* https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews */
51
+    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
52
+      WebView.setWebContentsDebuggingEnabled(true);
53
+    }
47 54
     SoLoader.init(this, /* native exopackage */ false);
48 55
     initializeFlipper(this); // Remove this line if you don't want Flipper enabled
49 56
   }

+ 4
- 4
example/android/build.gradle Zobrazit soubor

@@ -2,9 +2,9 @@
2 2
 
3 3
 buildscript {
4 4
     ext {
5
-        buildToolsVersion = "28.0.3"
5
+        buildToolsVersion = "29.0.3"
6 6
         minSdkVersion = 16
7
-        compileSdkVersion = 28
7
+        compileSdkVersion = 29
8 8
         targetSdkVersion = 28
9 9
     }
10 10
     repositories {
@@ -12,7 +12,7 @@ buildscript {
12 12
         jcenter()
13 13
     }
14 14
     dependencies {
15
-        classpath("com.android.tools.build:gradle:3.4.2")
15
+        classpath("com.android.tools.build:gradle:3.5.2")
16 16
 
17 17
         // NOTE: Do not place your application dependencies here; they belong
18 18
         // in the individual module build.gradle files
@@ -33,6 +33,6 @@ allprojects {
33 33
 
34 34
         google()
35 35
         jcenter()
36
-        maven { url 'https://jitpack.io' }
36
+        maven { url 'https://www.jitpack.io' }
37 37
     }
38 38
 }

+ 1
- 1
example/android/gradle/wrapper/gradle-wrapper.properties Zobrazit soubor

@@ -1,5 +1,5 @@
1 1
 distributionBase=GRADLE_USER_HOME
2 2
 distributionPath=wrapper/dists
3
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
3
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
4 4
 zipStoreBase=GRADLE_USER_HOME
5 5
 zipStorePath=wrapper/dists

+ 2
- 2
example/android/gradlew Zobrazit soubor

@@ -7,7 +7,7 @@
7 7
 # you may not use this file except in compliance with the License.
8 8
 # You may obtain a copy of the License at
9 9
 #
10
-#      http://www.apache.org/licenses/LICENSE-2.0
10
+#      https://www.apache.org/licenses/LICENSE-2.0
11 11
 #
12 12
 # Unless required by applicable law or agreed to in writing, software
13 13
 # distributed under the License is distributed on an "AS IS" BASIS,
@@ -126,7 +126,7 @@ if $darwin; then
126 126
 fi
127 127
 
128 128
 # For Cygwin, switch paths to Windows format before running java
129
-if $cygwin ; then
129
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130 130
     APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131 131
     CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132 132
     JAVACMD=`cygpath --unix "$JAVACMD"`

+ 100
- 100
example/android/gradlew.bat Zobrazit soubor

@@ -1,100 +1,100 @@
1
-@rem
2
-@rem Copyright 2015 the original author or authors.
3
-@rem
4
-@rem Licensed under the Apache License, Version 2.0 (the "License");
5
-@rem you may not use this file except in compliance with the License.
6
-@rem You may obtain a copy of the License at
7
-@rem
8
-@rem      http://www.apache.org/licenses/LICENSE-2.0
9
-@rem
10
-@rem Unless required by applicable law or agreed to in writing, software
11
-@rem distributed under the License is distributed on an "AS IS" BASIS,
12
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-@rem See the License for the specific language governing permissions and
14
-@rem limitations under the License.
15
-@rem
16
-
17
-@if "%DEBUG%" == "" @echo off
18
-@rem ##########################################################################
19
-@rem
20
-@rem  Gradle startup script for Windows
21
-@rem
22
-@rem ##########################################################################
23
-
24
-@rem Set local scope for the variables with windows NT shell
25
-if "%OS%"=="Windows_NT" setlocal
26
-
27
-set DIRNAME=%~dp0
28
-if "%DIRNAME%" == "" set DIRNAME=.
29
-set APP_BASE_NAME=%~n0
30
-set APP_HOME=%DIRNAME%
31
-
32
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34
-
35
-@rem Find java.exe
36
-if defined JAVA_HOME goto findJavaFromJavaHome
37
-
38
-set JAVA_EXE=java.exe
39
-%JAVA_EXE% -version >NUL 2>&1
40
-if "%ERRORLEVEL%" == "0" goto init
41
-
42
-echo.
43
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44
-echo.
45
-echo Please set the JAVA_HOME variable in your environment to match the
46
-echo location of your Java installation.
47
-
48
-goto fail
49
-
50
-:findJavaFromJavaHome
51
-set JAVA_HOME=%JAVA_HOME:"=%
52
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53
-
54
-if exist "%JAVA_EXE%" goto init
55
-
56
-echo.
57
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58
-echo.
59
-echo Please set the JAVA_HOME variable in your environment to match the
60
-echo location of your Java installation.
61
-
62
-goto fail
63
-
64
-:init
65
-@rem Get command-line arguments, handling Windows variants
66
-
67
-if not "%OS%" == "Windows_NT" goto win9xME_args
68
-
69
-:win9xME_args
70
-@rem Slurp the command line arguments.
71
-set CMD_LINE_ARGS=
72
-set _SKIP=2
73
-
74
-:win9xME_args_slurp
75
-if "x%~1" == "x" goto execute
76
-
77
-set CMD_LINE_ARGS=%*
78
-
79
-:execute
80
-@rem Setup the command line
81
-
82
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83
-
84
-@rem Execute Gradle
85
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86
-
87
-:end
88
-@rem End local scope for the variables with windows NT shell
89
-if "%ERRORLEVEL%"=="0" goto mainEnd
90
-
91
-:fail
92
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93
-rem the _cmd.exe /c_ return code!
94
-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95
-exit /b 1
96
-
97
-:mainEnd
98
-if "%OS%"=="Windows_NT" endlocal
99
-
100
-:omega
1
+@rem
2
+@rem Copyright 2015 the original author or authors.
3
+@rem
4
+@rem Licensed under the Apache License, Version 2.0 (the "License");
5
+@rem you may not use this file except in compliance with the License.
6
+@rem You may obtain a copy of the License at
7
+@rem
8
+@rem      http://www.apache.org/licenses/LICENSE-2.0
9
+@rem
10
+@rem Unless required by applicable law or agreed to in writing, software
11
+@rem distributed under the License is distributed on an "AS IS" BASIS,
12
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+@rem See the License for the specific language governing permissions and
14
+@rem limitations under the License.
15
+@rem
16
+
17
+@if "%DEBUG%" == "" @echo off
18
+@rem ##########################################################################
19
+@rem
20
+@rem  Gradle startup script for Windows
21
+@rem
22
+@rem ##########################################################################
23
+
24
+@rem Set local scope for the variables with windows NT shell
25
+if "%OS%"=="Windows_NT" setlocal
26
+
27
+set DIRNAME=%~dp0
28
+if "%DIRNAME%" == "" set DIRNAME=.
29
+set APP_BASE_NAME=%~n0
30
+set APP_HOME=%DIRNAME%
31
+
32
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34
+
35
+@rem Find java.exe
36
+if defined JAVA_HOME goto findJavaFromJavaHome
37
+
38
+set JAVA_EXE=java.exe
39
+%JAVA_EXE% -version >NUL 2>&1
40
+if "%ERRORLEVEL%" == "0" goto init
41
+
42
+echo.
43
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44
+echo.
45
+echo Please set the JAVA_HOME variable in your environment to match the
46
+echo location of your Java installation.
47
+
48
+goto fail
49
+
50
+:findJavaFromJavaHome
51
+set JAVA_HOME=%JAVA_HOME:"=%
52
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53
+
54
+if exist "%JAVA_EXE%" goto init
55
+
56
+echo.
57
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58
+echo.
59
+echo Please set the JAVA_HOME variable in your environment to match the
60
+echo location of your Java installation.
61
+
62
+goto fail
63
+
64
+:init
65
+@rem Get command-line arguments, handling Windows variants
66
+
67
+if not "%OS%" == "Windows_NT" goto win9xME_args
68
+
69
+:win9xME_args
70
+@rem Slurp the command line arguments.
71
+set CMD_LINE_ARGS=
72
+set _SKIP=2
73
+
74
+:win9xME_args_slurp
75
+if "x%~1" == "x" goto execute
76
+
77
+set CMD_LINE_ARGS=%*
78
+
79
+:execute
80
+@rem Setup the command line
81
+
82
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83
+
84
+@rem Execute Gradle
85
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86
+
87
+:end
88
+@rem End local scope for the variables with windows NT shell
89
+if "%ERRORLEVEL%"=="0" goto mainEnd
90
+
91
+:fail
92
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93
+rem the _cmd.exe /c_ return code!
94
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95
+exit /b 1
96
+
97
+:mainEnd
98
+if "%OS%"=="Windows_NT" endlocal
99
+
100
+:omega

+ 9
- 0
example/assets/test.html Zobrazit soubor

@@ -0,0 +1,9 @@
1
+<!doctype html>
2
+<html>
3
+    <head>
4
+        <title>Test</title>
5
+    </head>
6
+    <body>
7
+        <h2>Local page test</h2>
8
+    </body>
9
+</html>

+ 55
- 0
example/examples/Downloads.tsx Zobrazit soubor

@@ -0,0 +1,55 @@
1
+import React, {Component} from 'react';
2
+import {Alert, Platform, View} from 'react-native';
3
+
4
+import WebView, {FileDownload} from 'react-native-webview';
5
+
6
+const HTML = `
7
+<!DOCTYPE html>\n
8
+<html>
9
+  <head>
10
+    <title>Downloads</title>
11
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
12
+    <meta name="viewport" content="width=320, user-scalable=no">
13
+    <style type="text/css">
14
+      body {
15
+        margin: 0;
16
+        padding: 0;
17
+        font: 62.5% arial, sans-serif;
18
+        background: #ccc;
19
+      }
20
+    </style>
21
+  </head>
22
+  <body>
23
+    <a href="https://www.7-zip.org/a/7za920.zip">Example zip file download</a>
24
+  </body>
25
+</html>
26
+`;
27
+
28
+type Props = {};
29
+type State = {};
30
+
31
+export default class Downloads extends Component<Props, State> {
32
+  state = {};
33
+
34
+  onFileDownload = ({ nativeEvent }: { nativeEvent: FileDownload } ) => {
35
+    Alert.alert("File download detected", nativeEvent.downloadUrl);
36
+  };
37
+
38
+  render() {
39
+    const platformProps = Platform.select({
40
+      ios: {
41
+        onFileDownload: this.onFileDownload,
42
+      },
43
+    });
44
+
45
+    return (
46
+      <View style={{ height: 120 }}>
47
+        <WebView
48
+          source={{html: HTML}}
49
+          automaticallyAdjustContentInsets={false}
50
+          {...platformProps}
51
+        />
52
+      </View>
53
+    );
54
+  }
55
+}

+ 28
- 27
example/examples/Injection.tsx Zobrazit soubor

@@ -3,23 +3,23 @@ import {Text, View, ScrollView} from 'react-native';
3 3
 
4 4
 import WebView from 'react-native-webview';
5 5
 
6
-// const HTML = `
7
-// <!DOCTYPE html>
8
-// <html>
9
-//   <head>
10
-//       <meta charset="utf-8">
11
-//       <meta name="viewport" content="width=device-width, initial-scale=1">
12
-//       <title>iframe test</title>
13
-//   </head>
14
-//   <body>
15
-//     <p style="">beforeContentLoaded on the top frame <span id="before_failed" style="display: inline-block;">failed</span><span id="before_succeeded" style="display: none;">succeeded</span>!</p>
16
-//     <p style="">afterContentLoaded on the top frame <span id="after_failed" style="display: inline-block;">failed</span><span id="after_succeeded" style="display: none;">succeeded</span>!</p>
17
-//     <iframe src="https://birchlabs.co.uk/linguabrowse/infopages/obsol/iframe.html?v=1" name="iframe_0" style="width: 100%; height: 25px;"></iframe>
18
-//     <iframe src="https://birchlabs.co.uk/linguabrowse/infopages/obsol/iframe2.html?v=1" name="iframe_1" style="width: 100%; height: 25px;"></iframe>
19
-//     <iframe src="https://www.ebay.co.uk" name="iframe_2" style="width: 100%; height: 25px;"></iframe>
20
-//   </body>
21
-// </html>
22
-// `;
6
+const HTML = `
7
+<!DOCTYPE html>
8
+<html>
9
+  <head>
10
+      <meta charset="utf-8">
11
+      <meta name="viewport" content="width=device-width, initial-scale=1">
12
+      <title>iframe test</title>
13
+  </head>
14
+  <body>
15
+    <p style="">beforeContentLoaded on the top frame <span id="before_failed" style="display: inline-block;">failed</span><span id="before_succeeded" style="display: none;">succeeded</span>!</p>
16
+    <p style="">afterContentLoaded on the top frame <span id="after_failed" style="display: inline-block;">failed</span><span id="after_succeeded" style="display: none;">succeeded</span>!</p>
17
+    <iframe src="https://birchlabs.co.uk/linguabrowse/infopages/obsol/iframe.html?v=1" name="iframe_0" style="width: 100%; height: 25px;"></iframe>
18
+    <iframe src="https://birchlabs.co.uk/linguabrowse/infopages/obsol/iframe2.html?v=1" name="iframe_1" style="width: 100%; height: 25px;"></iframe>
19
+    <iframe src="https://www.ebay.co.uk" name="iframe_2" style="width: 100%; height: 25px;"></iframe>
20
+  </body>
21
+</html>
22
+`;
23 23
 
24 24
 type Props = {};
25 25
 type State = {
@@ -35,11 +35,12 @@ export default class Injection extends Component<Props, State> {
35 35
     return (
36 36
       <ScrollView>
37 37
         <View style={{ }}>
38
-          <View style={{ height: 300 }}>
38
+          <View style={{ height: 400 }}>
39 39
             <WebView
40 40
               /**
41
-               * This HTML is a copy of a multi-frame JS injection test that I had lying around.
42
-               * @see https://birchlabs.co.uk/linguabrowse/infopages/obsol/iframeTest.html
41
+               * This HTML is a copy of the hosted multi-frame JS injection test.
42
+               * I have found that Android doesn't support beforeContentLoaded for a hosted HTML webpage, yet does for a static source.
43
+               * The cause of this is unresolved.
43 44
                */
44 45
               // source={{ html: HTML }}
45 46
               source={{ uri: "https://birchlabs.co.uk/linguabrowse/infopages/obsol/rnw_iframe_test.html" }}
@@ -50,10 +51,12 @@ export default class Injection extends Component<Props, State> {
50 51
                * JS injection user scripts, consistent with current behaviour. This is undesirable,
51 52
                * so needs addressing in a follow-up PR. */
52 53
               onMessage={() => {}}
54
+              injectedJavaScriptBeforeContentLoadedForMainFrameOnly={false}
55
+              injectedJavaScriptForMainFrameOnly={false}
53 56
 
54 57
               /* We set this property in each frame */
55 58
               injectedJavaScriptBeforeContentLoaded={`
56
-              console.log("executing injectedJavaScriptBeforeContentLoaded...");
59
+              console.log("executing injectedJavaScriptBeforeContentLoaded... " + (new Date()).toString());
57 60
               if(typeof window.top.injectedIframesBeforeContentLoaded === "undefined"){
58 61
                 window.top.injectedIframesBeforeContentLoaded = [];
59 62
               }
@@ -84,12 +87,10 @@ export default class Injection extends Component<Props, State> {
84 87
                 console.log("wasn't window.top. Still going...");
85 88
               }
86 89
               `}
87
-              
88
-              injectedJavaScriptForMainFrameOnly={false}
89 90
 
90 91
               /* We read the colourToUse property in each frame to recolour each frame */
91 92
               injectedJavaScript={`
92
-              console.log("executing injectedJavaScript...");
93
+              console.log("executing injectedJavaScript... " + (new Date()).toString());
93 94
               if(typeof window.top.injectedIframesAfterContentLoaded === "undefined"){
94 95
                 window.top.injectedIframesAfterContentLoaded = [];
95 96
               }
@@ -119,7 +120,7 @@ export default class Injection extends Component<Props, State> {
119 120
                 // numberOfFramesAtAfterContentLoadedEle.id = "numberOfFramesAtAfterContentLoadedEle";
120 121
 
121 122
                 var namedFramesAtBeforeContentLoadedEle = document.createElement('p');
122
-                namedFramesAtBeforeContentLoadedEle.textContent = "Names of iframes that called beforeContentLoaded: " + JSON.stringify(window.top.injectedIframesBeforeContentLoaded);
123
+                namedFramesAtBeforeContentLoadedEle.textContent = "Names of iframes that called beforeContentLoaded: " + JSON.stringify(window.top.injectedIframesBeforeContentLoaded || []);
123 124
                 namedFramesAtBeforeContentLoadedEle.id = "namedFramesAtBeforeContentLoadedEle";
124 125
 
125 126
                 var namedFramesAtAfterContentLoadedEle = document.createElement('p');
@@ -147,8 +148,8 @@ export default class Injection extends Component<Props, State> {
147 148
         <Text>✅ If the main frame becomes orange, then top-frame injection both beforeContentLoaded and afterContentLoaded is supported.</Text>
148 149
         <Text>✅ If iframe_0, and iframe_1 become orange, then multi-frame injection beforeContentLoaded and afterContentLoaded is supported.</Text>
149 150
         <Text>✅ If the two texts say "beforeContentLoaded on the top frame succeeded!" and "afterContentLoaded on the top frame succeeded!", then both injection times are supported at least on the main frame.</Text>
150
-        <Text>⚠️ If either of the two iframes become coloured cyan, then for that given frame, JS injection succeeded after the content loaded, but didn't occur before the content loaded - please note that for iframes, this may not be a test failure, as it is not clear whether we would expect iframes to support an injection time of beforeContentLoaded anyway.</Text>
151
-        <Text>⚠️ If "Names of iframes that called beforeContentLoaded: " is [], then see above.</Text>
151
+        <Text> If either of the two iframes become coloured cyan, then for that given frame, JS injection succeeded after the content loaded, but didn't occur before the content loaded.</Text>
152
+        <Text> If "Names of iframes that called beforeContentLoaded: " is [], then see above.</Text>
152 153
         <Text>❌ If "Names of iframes that called afterContentLoaded: " is [], then afterContentLoaded is not supported in iframes.</Text>
153 154
         <Text>❌ If the main frame becomes coloured cyan, then JS injection succeeded after the content loaded, but didn't occur before the content loaded.</Text>
154 155
         <Text>❌ If the text "beforeContentLoaded on the top frame failed" remains unchanged, then JS injection has failed on the main frame before the content loaded.</Text>

+ 16
- 0
example/examples/LocalPageLoad.tsx Zobrazit soubor

@@ -0,0 +1,16 @@
1
+import React, {Component} from 'react';
2
+import {View, Text, Alert, TextInput, Button} from 'react-native';
3
+import WebView from 'react-native-webview';
4
+const localHtmlFile = require('../assets/test.html');
5
+
6
+export default class LocalPageLoad extends Component<Props, State> {
7
+    render() {
8
+      return (
9
+        <View>
10
+            <View style={{ width: '100%', height: '100%' }}>
11
+                <WebView source={localHtmlFile}/>
12
+          </View>
13
+        </View>
14
+      );
15
+    }
16
+  }

+ 6
- 6
example/ios/Podfile Zobrazit soubor

@@ -4,8 +4,10 @@ require_relative '../../node_modules/@react-native-community/cli-platform-ios/na
4 4
 project './example.xcodeproj'
5 5
 
6 6
 target 'example' do
7
-  # Pods for example
7
+  use_native_modules!
8
+
8 9
   pod 'react-native-webview', :path => "../.."
10
+
9 11
   pod 'FBLazyVector', :path => "../../node_modules/react-native/Libraries/FBLazyVector"
10 12
   pod 'FBReactNativeSpec', :path => "../../node_modules/react-native/Libraries/FBReactNativeSpec"
11 13
   pod 'RCTRequired', :path => "../../node_modules/react-native/Libraries/RCTRequired"
@@ -29,9 +31,9 @@ target 'example' do
29 31
   pod 'React-jsi', :path => '../../node_modules/react-native/ReactCommon/jsi'
30 32
   pod 'React-jsiexecutor', :path => '../../node_modules/react-native/ReactCommon/jsiexecutor'
31 33
   pod 'React-jsinspector', :path => '../../node_modules/react-native/ReactCommon/jsinspector'
32
-  pod 'ReactCommon/jscallinvoker', :path => "../../node_modules/react-native/ReactCommon"
34
+  pod 'ReactCommon/callinvoker', :path => "../../node_modules/react-native/ReactCommon"
33 35
   pod 'ReactCommon/turbomodule/core', :path => "../../node_modules/react-native/ReactCommon"
34
-  pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga'
36
+  pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga', :modular_headers => true
35 37
 
36 38
   pod 'DoubleConversion', :podspec => '../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
37 39
   pod 'glog', :podspec => '../../node_modules/react-native/third-party-podspecs/glog.podspec'
@@ -41,15 +43,13 @@ target 'example' do
41 43
     inherit! :search_paths
42 44
     # Pods for testing
43 45
   end
44
-
45
-  use_native_modules!
46 46
 end
47 47
 
48 48
 target 'example-tvOS' do
49 49
   # Pods for example-tvOS
50 50
 
51 51
   target 'example-tvOSTests' do
52
-    inherit! :search_paths
52
+    inherit! :complete
53 53
     # Pods for testing
54 54
   end
55 55
 

+ 181
- 157
example/ios/Podfile.lock Zobrazit soubor

@@ -1,14 +1,14 @@
1 1
 PODS:
2 2
   - boost-for-react-native (1.63.0)
3 3
   - DoubleConversion (1.1.6)
4
-  - FBLazyVector (0.61.5)
5
-  - FBReactNativeSpec (0.61.5):
4
+  - FBLazyVector (0.62.2)
5
+  - FBReactNativeSpec (0.62.2):
6 6
     - Folly (= 2018.10.22.00)
7
-    - RCTRequired (= 0.61.5)
8
-    - RCTTypeSafety (= 0.61.5)
9
-    - React-Core (= 0.61.5)
10
-    - React-jsi (= 0.61.5)
11
-    - ReactCommon/turbomodule/core (= 0.61.5)
7
+    - RCTRequired (= 0.62.2)
8
+    - RCTTypeSafety (= 0.62.2)
9
+    - React-Core (= 0.62.2)
10
+    - React-jsi (= 0.62.2)
11
+    - ReactCommon/turbomodule/core (= 0.62.2)
12 12
   - Folly (2018.10.22.00):
13 13
     - boost-for-react-native
14 14
     - DoubleConversion
@@ -19,206 +19,230 @@ PODS:
19 19
     - DoubleConversion
20 20
     - glog
21 21
   - glog (0.3.5)
22
-  - RCTRequired (0.61.5)
23
-  - RCTTypeSafety (0.61.5):
24
-    - FBLazyVector (= 0.61.5)
22
+  - RCTRequired (0.62.2)
23
+  - RCTTypeSafety (0.62.2):
24
+    - FBLazyVector (= 0.62.2)
25 25
     - Folly (= 2018.10.22.00)
26
-    - RCTRequired (= 0.61.5)
27
-    - React-Core (= 0.61.5)
28
-  - React (0.61.5):
29
-    - React-Core (= 0.61.5)
30
-    - React-Core/DevSupport (= 0.61.5)
31
-    - React-Core/RCTWebSocket (= 0.61.5)
32
-    - React-RCTActionSheet (= 0.61.5)
33
-    - React-RCTAnimation (= 0.61.5)
34
-    - React-RCTBlob (= 0.61.5)
35
-    - React-RCTImage (= 0.61.5)
36
-    - React-RCTLinking (= 0.61.5)
37
-    - React-RCTNetwork (= 0.61.5)
38
-    - React-RCTSettings (= 0.61.5)
39
-    - React-RCTText (= 0.61.5)
40
-    - React-RCTVibration (= 0.61.5)
41
-  - React-Core (0.61.5):
26
+    - RCTRequired (= 0.62.2)
27
+    - React-Core (= 0.62.2)
28
+  - React (0.62.2):
29
+    - React-Core (= 0.62.2)
30
+    - React-Core/DevSupport (= 0.62.2)
31
+    - React-Core/RCTWebSocket (= 0.62.2)
32
+    - React-RCTActionSheet (= 0.62.2)
33
+    - React-RCTAnimation (= 0.62.2)
34
+    - React-RCTBlob (= 0.62.2)
35
+    - React-RCTImage (= 0.62.2)
36
+    - React-RCTLinking (= 0.62.2)
37
+    - React-RCTNetwork (= 0.62.2)
38
+    - React-RCTSettings (= 0.62.2)
39
+    - React-RCTText (= 0.62.2)
40
+    - React-RCTVibration (= 0.62.2)
41
+  - React-Core (0.62.2):
42 42
     - Folly (= 2018.10.22.00)
43 43
     - glog
44
-    - React-Core/Default (= 0.61.5)
45
-    - React-cxxreact (= 0.61.5)
46
-    - React-jsi (= 0.61.5)
47
-    - React-jsiexecutor (= 0.61.5)
44
+    - React-Core/Default (= 0.62.2)
45
+    - React-cxxreact (= 0.62.2)
46
+    - React-jsi (= 0.62.2)
47
+    - React-jsiexecutor (= 0.62.2)
48 48
     - Yoga
49
-  - React-Core/CoreModulesHeaders (0.61.5):
49
+  - React-Core/CoreModulesHeaders (0.62.2):
50 50
     - Folly (= 2018.10.22.00)
51 51
     - glog
52 52
     - React-Core/Default
53
-    - React-cxxreact (= 0.61.5)
54
-    - React-jsi (= 0.61.5)
55
-    - React-jsiexecutor (= 0.61.5)
53
+    - React-cxxreact (= 0.62.2)
54
+    - React-jsi (= 0.62.2)
55
+    - React-jsiexecutor (= 0.62.2)
56 56
     - Yoga
57
-  - React-Core/Default (0.61.5):
57
+  - React-Core/Default (0.62.2):
58 58
     - Folly (= 2018.10.22.00)
59 59
     - glog
60
-    - React-cxxreact (= 0.61.5)
61
-    - React-jsi (= 0.61.5)
62
-    - React-jsiexecutor (= 0.61.5)
60
+    - React-cxxreact (= 0.62.2)
61
+    - React-jsi (= 0.62.2)
62
+    - React-jsiexecutor (= 0.62.2)
63 63
     - Yoga
64
-  - React-Core/DevSupport (0.61.5):
64
+  - React-Core/DevSupport (0.62.2):
65 65
     - Folly (= 2018.10.22.00)
66 66
     - glog
67
-    - React-Core/Default (= 0.61.5)
68
-    - React-Core/RCTWebSocket (= 0.61.5)
69
-    - React-cxxreact (= 0.61.5)
70
-    - React-jsi (= 0.61.5)
71
-    - React-jsiexecutor (= 0.61.5)
72
-    - React-jsinspector (= 0.61.5)
67
+    - React-Core/Default (= 0.62.2)
68
+    - React-Core/RCTWebSocket (= 0.62.2)
69
+    - React-cxxreact (= 0.62.2)
70
+    - React-jsi (= 0.62.2)
71
+    - React-jsiexecutor (= 0.62.2)
72
+    - React-jsinspector (= 0.62.2)
73 73
     - Yoga
74
-  - React-Core/RCTActionSheetHeaders (0.61.5):
74
+  - React-Core/RCTActionSheetHeaders (0.62.2):
75 75
     - Folly (= 2018.10.22.00)
76 76
     - glog
77 77
     - React-Core/Default
78
-    - React-cxxreact (= 0.61.5)
79
-    - React-jsi (= 0.61.5)
80
-    - React-jsiexecutor (= 0.61.5)
78
+    - React-cxxreact (= 0.62.2)
79
+    - React-jsi (= 0.62.2)
80
+    - React-jsiexecutor (= 0.62.2)
81 81
     - Yoga
82
-  - React-Core/RCTAnimationHeaders (0.61.5):
82
+  - React-Core/RCTAnimationHeaders (0.62.2):
83 83
     - Folly (= 2018.10.22.00)
84 84
     - glog
85 85
     - React-Core/Default
86
-    - React-cxxreact (= 0.61.5)
87
-    - React-jsi (= 0.61.5)
88
-    - React-jsiexecutor (= 0.61.5)
86
+    - React-cxxreact (= 0.62.2)
87
+    - React-jsi (= 0.62.2)
88
+    - React-jsiexecutor (= 0.62.2)
89 89
     - Yoga
90
-  - React-Core/RCTBlobHeaders (0.61.5):
90
+  - React-Core/RCTBlobHeaders (0.62.2):
91 91
     - Folly (= 2018.10.22.00)
92 92
     - glog
93 93
     - React-Core/Default
94
-    - React-cxxreact (= 0.61.5)
95
-    - React-jsi (= 0.61.5)
96
-    - React-jsiexecutor (= 0.61.5)
94
+    - React-cxxreact (= 0.62.2)
95
+    - React-jsi (= 0.62.2)
96
+    - React-jsiexecutor (= 0.62.2)
97 97
     - Yoga
98
-  - React-Core/RCTImageHeaders (0.61.5):
98
+  - React-Core/RCTImageHeaders (0.62.2):
99 99
     - Folly (= 2018.10.22.00)
100 100
     - glog
101 101
     - React-Core/Default
102
-    - React-cxxreact (= 0.61.5)
103
-    - React-jsi (= 0.61.5)
104
-    - React-jsiexecutor (= 0.61.5)
102
+    - React-cxxreact (= 0.62.2)
103
+    - React-jsi (= 0.62.2)
104
+    - React-jsiexecutor (= 0.62.2)
105 105
     - Yoga
106
-  - React-Core/RCTLinkingHeaders (0.61.5):
106
+  - React-Core/RCTLinkingHeaders (0.62.2):
107 107
     - Folly (= 2018.10.22.00)
108 108
     - glog
109 109
     - React-Core/Default
110
-    - React-cxxreact (= 0.61.5)
111
-    - React-jsi (= 0.61.5)
112
-    - React-jsiexecutor (= 0.61.5)
110
+    - React-cxxreact (= 0.62.2)
111
+    - React-jsi (= 0.62.2)
112
+    - React-jsiexecutor (= 0.62.2)
113 113
     - Yoga
114
-  - React-Core/RCTNetworkHeaders (0.61.5):
114
+  - React-Core/RCTNetworkHeaders (0.62.2):
115 115
     - Folly (= 2018.10.22.00)
116 116
     - glog
117 117
     - React-Core/Default
118
-    - React-cxxreact (= 0.61.5)
119
-    - React-jsi (= 0.61.5)
120
-    - React-jsiexecutor (= 0.61.5)
118
+    - React-cxxreact (= 0.62.2)
119
+    - React-jsi (= 0.62.2)
120
+    - React-jsiexecutor (= 0.62.2)
121 121
     - Yoga
122
-  - React-Core/RCTSettingsHeaders (0.61.5):
122
+  - React-Core/RCTSettingsHeaders (0.62.2):
123 123
     - Folly (= 2018.10.22.00)
124 124
     - glog
125 125
     - React-Core/Default
126
-    - React-cxxreact (= 0.61.5)
127
-    - React-jsi (= 0.61.5)
128
-    - React-jsiexecutor (= 0.61.5)
126
+    - React-cxxreact (= 0.62.2)
127
+    - React-jsi (= 0.62.2)
128
+    - React-jsiexecutor (= 0.62.2)
129 129
     - Yoga
130
-  - React-Core/RCTTextHeaders (0.61.5):
130
+  - React-Core/RCTTextHeaders (0.62.2):
131 131
     - Folly (= 2018.10.22.00)
132 132
     - glog
133 133
     - React-Core/Default
134
-    - React-cxxreact (= 0.61.5)
135
-    - React-jsi (= 0.61.5)
136
-    - React-jsiexecutor (= 0.61.5)
134
+    - React-cxxreact (= 0.62.2)
135
+    - React-jsi (= 0.62.2)
136
+    - React-jsiexecutor (= 0.62.2)
137 137
     - Yoga
138
-  - React-Core/RCTVibrationHeaders (0.61.5):
138
+  - React-Core/RCTVibrationHeaders (0.62.2):
139 139
     - Folly (= 2018.10.22.00)
140 140
     - glog
141 141
     - React-Core/Default
142
-    - React-cxxreact (= 0.61.5)
143
-    - React-jsi (= 0.61.5)
144
-    - React-jsiexecutor (= 0.61.5)
142
+    - React-cxxreact (= 0.62.2)
143
+    - React-jsi (= 0.62.2)
144
+    - React-jsiexecutor (= 0.62.2)
145 145
     - Yoga
146
-  - React-Core/RCTWebSocket (0.61.5):
146
+  - React-Core/RCTWebSocket (0.62.2):
147 147
     - Folly (= 2018.10.22.00)
148 148
     - glog
149
-    - React-Core/Default (= 0.61.5)
150
-    - React-cxxreact (= 0.61.5)
151
-    - React-jsi (= 0.61.5)
152
-    - React-jsiexecutor (= 0.61.5)
149
+    - React-Core/Default (= 0.62.2)
150
+    - React-cxxreact (= 0.62.2)
151
+    - React-jsi (= 0.62.2)
152
+    - React-jsiexecutor (= 0.62.2)
153 153
     - Yoga
154
-  - React-CoreModules (0.61.5):
155
-    - FBReactNativeSpec (= 0.61.5)
154
+  - React-CoreModules (0.62.2):
155
+    - FBReactNativeSpec (= 0.62.2)
156 156
     - Folly (= 2018.10.22.00)
157
-    - RCTTypeSafety (= 0.61.5)
158
-    - React-Core/CoreModulesHeaders (= 0.61.5)
159
-    - React-RCTImage (= 0.61.5)
160
-    - ReactCommon/turbomodule/core (= 0.61.5)
161
-  - React-cxxreact (0.61.5):
157
+    - RCTTypeSafety (= 0.62.2)
158
+    - React-Core/CoreModulesHeaders (= 0.62.2)
159
+    - React-RCTImage (= 0.62.2)
160
+    - ReactCommon/turbomodule/core (= 0.62.2)
161
+  - React-cxxreact (0.62.2):
162 162
     - boost-for-react-native (= 1.63.0)
163 163
     - DoubleConversion
164 164
     - Folly (= 2018.10.22.00)
165 165
     - glog
166
-    - React-jsinspector (= 0.61.5)
167
-  - React-jsi (0.61.5):
166
+    - React-jsinspector (= 0.62.2)
167
+  - React-jsi (0.62.2):
168 168
     - boost-for-react-native (= 1.63.0)
169 169
     - DoubleConversion
170 170
     - Folly (= 2018.10.22.00)
171 171
     - glog
172
-    - React-jsi/Default (= 0.61.5)
173
-  - React-jsi/Default (0.61.5):
172
+    - React-jsi/Default (= 0.62.2)
173
+  - React-jsi/Default (0.62.2):
174 174
     - boost-for-react-native (= 1.63.0)
175 175
     - DoubleConversion
176 176
     - Folly (= 2018.10.22.00)
177 177
     - glog
178
-  - React-jsiexecutor (0.61.5):
178
+  - React-jsiexecutor (0.62.2):
179 179
     - DoubleConversion
180 180
     - Folly (= 2018.10.22.00)
181 181
     - glog
182
-    - React-cxxreact (= 0.61.5)
183
-    - React-jsi (= 0.61.5)
184
-  - React-jsinspector (0.61.5)
185
-  - react-native-webview (8.2.0):
182
+    - React-cxxreact (= 0.62.2)
183
+    - React-jsi (= 0.62.2)
184
+  - React-jsinspector (0.62.2)
185
+  - react-native-webview (9.4.0):
186 186
     - React
187
-  - React-RCTActionSheet (0.61.5):
188
-    - React-Core/RCTActionSheetHeaders (= 0.61.5)
189
-  - React-RCTAnimation (0.61.5):
190
-    - React-Core/RCTAnimationHeaders (= 0.61.5)
191
-  - React-RCTBlob (0.61.5):
192
-    - React-Core/RCTBlobHeaders (= 0.61.5)
193
-    - React-Core/RCTWebSocket (= 0.61.5)
194
-    - React-jsi (= 0.61.5)
195
-    - React-RCTNetwork (= 0.61.5)
196
-  - React-RCTImage (0.61.5):
197
-    - React-Core/RCTImageHeaders (= 0.61.5)
198
-    - React-RCTNetwork (= 0.61.5)
199
-  - React-RCTLinking (0.61.5):
200
-    - React-Core/RCTLinkingHeaders (= 0.61.5)
201
-  - React-RCTNetwork (0.61.5):
202
-    - React-Core/RCTNetworkHeaders (= 0.61.5)
203
-  - React-RCTSettings (0.61.5):
204
-    - React-Core/RCTSettingsHeaders (= 0.61.5)
205
-  - React-RCTText (0.61.5):
206
-    - React-Core/RCTTextHeaders (= 0.61.5)
207
-  - React-RCTVibration (0.61.5):
208
-    - React-Core/RCTVibrationHeaders (= 0.61.5)
209
-  - ReactCommon/jscallinvoker (0.61.5):
187
+  - React-RCTActionSheet (0.62.2):
188
+    - React-Core/RCTActionSheetHeaders (= 0.62.2)
189
+  - React-RCTAnimation (0.62.2):
190
+    - FBReactNativeSpec (= 0.62.2)
191
+    - Folly (= 2018.10.22.00)
192
+    - RCTTypeSafety (= 0.62.2)
193
+    - React-Core/RCTAnimationHeaders (= 0.62.2)
194
+    - ReactCommon/turbomodule/core (= 0.62.2)
195
+  - React-RCTBlob (0.62.2):
196
+    - FBReactNativeSpec (= 0.62.2)
197
+    - Folly (= 2018.10.22.00)
198
+    - React-Core/RCTBlobHeaders (= 0.62.2)
199
+    - React-Core/RCTWebSocket (= 0.62.2)
200
+    - React-jsi (= 0.62.2)
201
+    - React-RCTNetwork (= 0.62.2)
202
+    - ReactCommon/turbomodule/core (= 0.62.2)
203
+  - React-RCTImage (0.62.2):
204
+    - FBReactNativeSpec (= 0.62.2)
205
+    - Folly (= 2018.10.22.00)
206
+    - RCTTypeSafety (= 0.62.2)
207
+    - React-Core/RCTImageHeaders (= 0.62.2)
208
+    - React-RCTNetwork (= 0.62.2)
209
+    - ReactCommon/turbomodule/core (= 0.62.2)
210
+  - React-RCTLinking (0.62.2):
211
+    - FBReactNativeSpec (= 0.62.2)
212
+    - React-Core/RCTLinkingHeaders (= 0.62.2)
213
+    - ReactCommon/turbomodule/core (= 0.62.2)
214
+  - React-RCTNetwork (0.62.2):
215
+    - FBReactNativeSpec (= 0.62.2)
216
+    - Folly (= 2018.10.22.00)
217
+    - RCTTypeSafety (= 0.62.2)
218
+    - React-Core/RCTNetworkHeaders (= 0.62.2)
219
+    - ReactCommon/turbomodule/core (= 0.62.2)
220
+  - React-RCTSettings (0.62.2):
221
+    - FBReactNativeSpec (= 0.62.2)
222
+    - Folly (= 2018.10.22.00)
223
+    - RCTTypeSafety (= 0.62.2)
224
+    - React-Core/RCTSettingsHeaders (= 0.62.2)
225
+    - ReactCommon/turbomodule/core (= 0.62.2)
226
+  - React-RCTText (0.62.2):
227
+    - React-Core/RCTTextHeaders (= 0.62.2)
228
+  - React-RCTVibration (0.62.2):
229
+    - FBReactNativeSpec (= 0.62.2)
230
+    - Folly (= 2018.10.22.00)
231
+    - React-Core/RCTVibrationHeaders (= 0.62.2)
232
+    - ReactCommon/turbomodule/core (= 0.62.2)
233
+  - ReactCommon/callinvoker (0.62.2):
210 234
     - DoubleConversion
211 235
     - Folly (= 2018.10.22.00)
212 236
     - glog
213
-    - React-cxxreact (= 0.61.5)
214
-  - ReactCommon/turbomodule/core (0.61.5):
237
+    - React-cxxreact (= 0.62.2)
238
+  - ReactCommon/turbomodule/core (0.62.2):
215 239
     - DoubleConversion
216 240
     - Folly (= 2018.10.22.00)
217 241
     - glog
218
-    - React-Core (= 0.61.5)
219
-    - React-cxxreact (= 0.61.5)
220
-    - React-jsi (= 0.61.5)
221
-    - ReactCommon/jscallinvoker (= 0.61.5)
242
+    - React-Core (= 0.62.2)
243
+    - React-cxxreact (= 0.62.2)
244
+    - React-jsi (= 0.62.2)
245
+    - ReactCommon/callinvoker (= 0.62.2)
222 246
   - Yoga (1.14.0)
223 247
 
224 248
 DEPENDENCIES:
@@ -248,7 +272,7 @@ DEPENDENCIES:
248 272
   - React-RCTSettings (from `../../node_modules/react-native/Libraries/Settings`)
249 273
   - React-RCTText (from `../../node_modules/react-native/Libraries/Text`)
250 274
   - React-RCTVibration (from `../../node_modules/react-native/Libraries/Vibration`)
251
-  - ReactCommon/jscallinvoker (from `../../node_modules/react-native/ReactCommon`)
275
+  - ReactCommon/callinvoker (from `../../node_modules/react-native/ReactCommon`)
252 276
   - ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`)
253 277
   - Yoga (from `../../node_modules/react-native/ReactCommon/yoga`)
254 278
 
@@ -313,32 +337,32 @@ EXTERNAL SOURCES:
313 337
 SPEC CHECKSUMS:
314 338
   boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
315 339
   DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
316
-  FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f
317
-  FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75
340
+  FBLazyVector: 4aab18c93cd9546e4bfed752b4084585eca8b245
341
+  FBReactNativeSpec: 5465d51ccfeecb7faa12f9ae0024f2044ce4044e
318 342
   Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
319 343
   glog: 1f3da668190260b06b429bb211bfbee5cd790c28
320
-  RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1
321
-  RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320
322
-  React: b6a59ef847b2b40bb6e0180a97d0ca716969ac78
323
-  React-Core: 688b451f7d616cc1134ac95295b593d1b5158a04
324
-  React-CoreModules: d04f8494c1a328b69ec11db9d1137d667f916dcb
325
-  React-cxxreact: d0f7bcafa196ae410e5300736b424455e7fb7ba7
326
-  React-jsi: cb2cd74d7ccf4cffb071a46833613edc79cdf8f7
327
-  React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
328
-  React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
329
-  react-native-webview: 1db33907230d0eb344964d6f3bb56b9ee77e25a4
330
-  React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
331
-  React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
332
-  React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72
333
-  React-RCTImage: 6b8e8df449eb7c814c99a92d6b52de6fe39dea4e
334
-  React-RCTLinking: 121bb231c7503cf9094f4d8461b96a130fabf4a5
335
-  React-RCTNetwork: fb353640aafcee84ca8b78957297bd395f065c9a
336
-  React-RCTSettings: 8db258ea2a5efee381fcf7a6d5044e2f8b68b640
337
-  React-RCTText: 9ccc88273e9a3aacff5094d2175a605efa854dbe
338
-  React-RCTVibration: a49a1f42bf8f5acf1c3e297097517c6b3af377ad
339
-  ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd
340
-  Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b
344
+  RCTRequired: cec6a34b3ac8a9915c37e7e4ad3aa74726ce4035
345
+  RCTTypeSafety: 93006131180074cffa227a1075802c89a49dd4ce
346
+  React: 29a8b1a02bd764fb7644ef04019270849b9a7ac3
347
+  React-Core: b12bffb3f567fdf99510acb716ef1abd426e0e05
348
+  React-CoreModules: 4a9b87bbe669d6c3173c0132c3328e3b000783d0
349
+  React-cxxreact: e65f9c2ba0ac5be946f53548c1aaaee5873a8103
350
+  React-jsi: b6dc94a6a12ff98e8877287a0b7620d365201161
351
+  React-jsiexecutor: 1540d1c01bb493ae3124ed83351b1b6a155db7da
352
+  React-jsinspector: 512e560d0e985d0e8c479a54a4e5c147a9c83493
353
+  react-native-webview: cf5527893252b3b036eea024a1da6996f7344c74
354
+  React-RCTActionSheet: f41ea8a811aac770e0cc6e0ad6b270c644ea8b7c
355
+  React-RCTAnimation: 49ab98b1c1ff4445148b72a3d61554138565bad0
356
+  React-RCTBlob: a332773f0ebc413a0ce85942a55b064471587a71
357
+  React-RCTImage: e70be9b9c74fe4e42d0005f42cace7981c994ac3
358
+  React-RCTLinking: c1b9739a88d56ecbec23b7f63650e44672ab2ad2
359
+  React-RCTNetwork: 73138b6f45e5a2768ad93f3d57873c2a18d14b44
360
+  React-RCTSettings: 6e3738a87e21b39a8cb08d627e68c44acf1e325a
361
+  React-RCTText: fae545b10cfdb3d247c36c56f61a94cfd6dba41d
362
+  React-RCTVibration: 4356114dbcba4ce66991096e51a66e61eda51256
363
+  ReactCommon: ed4e11d27609d571e7eee8b65548efc191116eb3
364
+  Yoga: 3ebccbdd559724312790e7742142d062476b698e
341 365
 
342
-PODFILE CHECKSUM: 2b0bdb79b803eefe541da6f9be6b06e99063bbfd
366
+PODFILE CHECKSUM: 767ae042fafc1aba97b301c58c340ff6f992aa27
343 367
 
344
-COCOAPODS: 1.8.4
368
+COCOAPODS: 1.9.1

+ 11
- 7
example/ios/example.xcodeproj/project.pbxproj Zobrazit soubor

@@ -16,7 +16,7 @@
16 16
 		2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
17 17
 		2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
18 18
 		2DCD954D1E0B4F2C00145EB5 /* exampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* exampleTests.m */; };
19
-		A08B6FFAAF3CA0F03003FEB0 /* libPods-example-tvOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5544B310E076E06B9E2EFF4C /* libPods-example-tvOSTests.a */; };
19
+		646BD8E8CDDF5A464B5419B3 /* libPods-example-tvOS-example-tvOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4830F7139A954350DD22DE4A /* libPods-example-tvOS-example-tvOSTests.a */; };
20 20
 		C7D826CF866C25BE421302B6 /* libPods-example-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F9A8A9F158876EC099CFA57A /* libPods-example-tvOS.a */; };
21 21
 		D0E3313DFCE78BFCB650F812 /* libPods-exampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CB301596D47BBAD9E9C0A45A /* libPods-exampleTests.a */; };
22 22
 		E719A6E171791CD8906B3D55 /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 917A19FC1EBE6E8B85FE404D /* libPods-example.a */; };
@@ -55,9 +55,10 @@
55 55
 		2D02E4901E0B4A5D006451C7 /* example-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "example-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
56 56
 		41B6A4553C4F552488B69B01 /* Pods-exampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-exampleTests.release.xcconfig"; path = "Target Support Files/Pods-exampleTests/Pods-exampleTests.release.xcconfig"; sourceTree = "<group>"; };
57 57
 		4372A2FD2D749DE5C9FD8D3E /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = "<group>"; };
58
+		4830F7139A954350DD22DE4A /* libPods-example-tvOS-example-tvOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example-tvOS-example-tvOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
58 59
 		4FDD34C422D711AC8A7B10A7 /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = "<group>"; };
59
-		5544B310E076E06B9E2EFF4C /* libPods-example-tvOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example-tvOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
60 60
 		59A4F27CAD1B7EFE80917453 /* Pods-example-tvOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-tvOSTests.release.xcconfig"; path = "Target Support Files/Pods-example-tvOSTests/Pods-example-tvOSTests.release.xcconfig"; sourceTree = "<group>"; };
61
+		6517B8E7187010A1D58A96EE /* Pods-example-tvOS-example-tvOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-tvOS-example-tvOSTests.debug.xcconfig"; path = "Target Support Files/Pods-example-tvOS-example-tvOSTests/Pods-example-tvOS-example-tvOSTests.debug.xcconfig"; sourceTree = "<group>"; };
61 62
 		775F6B7492793F5DB7ECE95B /* Pods-example-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-tvOS.debug.xcconfig"; path = "Target Support Files/Pods-example-tvOS/Pods-example-tvOS.debug.xcconfig"; sourceTree = "<group>"; };
62 63
 		8A20011E75A0AD2EC5C6EAE9 /* Pods-exampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-exampleTests.debug.xcconfig"; path = "Target Support Files/Pods-exampleTests/Pods-exampleTests.debug.xcconfig"; sourceTree = "<group>"; };
63 64
 		917A19FC1EBE6E8B85FE404D /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -65,6 +66,7 @@
65 66
 		ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
66 67
 		ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
67 68
 		EDF80BE96CF92848F4E926EA /* Pods-example-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-tvOS.release.xcconfig"; path = "Target Support Files/Pods-example-tvOS/Pods-example-tvOS.release.xcconfig"; sourceTree = "<group>"; };
69
+		EE3925F4209E17ECF3E692D1 /* Pods-example-tvOS-example-tvOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-tvOS-example-tvOSTests.release.xcconfig"; path = "Target Support Files/Pods-example-tvOS-example-tvOSTests/Pods-example-tvOS-example-tvOSTests.release.xcconfig"; sourceTree = "<group>"; };
68 70
 		F67BC8D73DE103BA10A5488D /* Pods-example-tvOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-tvOSTests.debug.xcconfig"; path = "Target Support Files/Pods-example-tvOSTests/Pods-example-tvOSTests.debug.xcconfig"; sourceTree = "<group>"; };
69 71
 		F9A8A9F158876EC099CFA57A /* libPods-example-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
70 72
 /* End PBXFileReference section */
@@ -98,7 +100,7 @@
98 100
 			isa = PBXFrameworksBuildPhase;
99 101
 			buildActionMask = 2147483647;
100 102
 			files = (
101
-				A08B6FFAAF3CA0F03003FEB0 /* libPods-example-tvOSTests.a in Frameworks */,
103
+				646BD8E8CDDF5A464B5419B3 /* libPods-example-tvOS-example-tvOSTests.a in Frameworks */,
102 104
 			);
103 105
 			runOnlyForDeploymentPostprocessing = 0;
104 106
 		};
@@ -143,8 +145,8 @@
143 145
 				ED2971642150620600B7C4FE /* JavaScriptCore.framework */,
144 146
 				917A19FC1EBE6E8B85FE404D /* libPods-example.a */,
145 147
 				F9A8A9F158876EC099CFA57A /* libPods-example-tvOS.a */,
146
-				5544B310E076E06B9E2EFF4C /* libPods-example-tvOSTests.a */,
147 148
 				CB301596D47BBAD9E9C0A45A /* libPods-exampleTests.a */,
149
+				4830F7139A954350DD22DE4A /* libPods-example-tvOS-example-tvOSTests.a */,
148 150
 			);
149 151
 			name = Frameworks;
150 152
 			sourceTree = "<group>";
@@ -193,6 +195,8 @@
193 195
 				59A4F27CAD1B7EFE80917453 /* Pods-example-tvOSTests.release.xcconfig */,
194 196
 				8A20011E75A0AD2EC5C6EAE9 /* Pods-exampleTests.debug.xcconfig */,
195 197
 				41B6A4553C4F552488B69B01 /* Pods-exampleTests.release.xcconfig */,
198
+				6517B8E7187010A1D58A96EE /* Pods-example-tvOS-example-tvOSTests.debug.xcconfig */,
199
+				EE3925F4209E17ECF3E692D1 /* Pods-example-tvOS-example-tvOSTests.release.xcconfig */,
196 200
 			);
197 201
 			path = Pods;
198 202
 			sourceTree = "<group>";
@@ -402,7 +406,7 @@
402 406
 			outputFileListPaths = (
403 407
 			);
404 408
 			outputPaths = (
405
-				"$(DERIVED_FILE_DIR)/Pods-example-tvOSTests-checkManifestLockResult.txt",
409
+				"$(DERIVED_FILE_DIR)/Pods-example-tvOS-example-tvOSTests-checkManifestLockResult.txt",
406 410
 			);
407 411
 			runOnlyForDeploymentPostprocessing = 0;
408 412
 			shellPath = /bin/sh;
@@ -718,7 +722,7 @@
718 722
 		};
719 723
 		2D02E4991E0B4A5E006451C7 /* Debug */ = {
720 724
 			isa = XCBuildConfiguration;
721
-			baseConfigurationReference = F67BC8D73DE103BA10A5488D /* Pods-example-tvOSTests.debug.xcconfig */;
725
+			baseConfigurationReference = 6517B8E7187010A1D58A96EE /* Pods-example-tvOS-example-tvOSTests.debug.xcconfig */;
722 726
 			buildSettings = {
723 727
 				BUNDLE_LOADER = "$(TEST_HOST)";
724 728
 				CLANG_ANALYZER_NONNULL = YES;
@@ -745,7 +749,7 @@
745 749
 		};
746 750
 		2D02E49A1E0B4A5E006451C7 /* Release */ = {
747 751
 			isa = XCBuildConfiguration;
748
-			baseConfigurationReference = 59A4F27CAD1B7EFE80917453 /* Pods-example-tvOSTests.release.xcconfig */;
752
+			baseConfigurationReference = EE3925F4209E17ECF3E692D1 /* Pods-example-tvOS-example-tvOSTests.release.xcconfig */;
749 753
 			buildSettings = {
750 754
 				BUNDLE_LOADER = "$(TEST_HOST)";
751 755
 				CLANG_ANALYZER_NONNULL = YES;

+ 2
- 43
example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme Zobrazit soubor

@@ -1,25 +1,11 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <Scheme
3
-   LastUpgradeVersion = "0940"
3
+   LastUpgradeVersion = "1130"
4 4
    version = "1.3">
5 5
    <BuildAction
6
-      parallelizeBuildables = "NO"
6
+      parallelizeBuildables = "YES"
7 7
       buildImplicitDependencies = "YES">
8 8
       <BuildActionEntries>
9
-         <BuildActionEntry
10
-            buildForTesting = "YES"
11
-            buildForRunning = "YES"
12
-            buildForProfiling = "YES"
13
-            buildForArchiving = "YES"
14
-            buildForAnalyzing = "YES">
15
-            <BuildableReference
16
-               BuildableIdentifier = "primary"
17
-               BlueprintIdentifier = "2D2A28121D9B038B00D4039D"
18
-               BuildableName = "libReact.a"
19
-               BlueprintName = "React-tvOS"
20
-               ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
-            </BuildableReference>
22
-         </BuildActionEntry>
23 9
          <BuildActionEntry
24 10
             buildForTesting = "YES"
25 11
             buildForRunning = "YES"
@@ -34,20 +20,6 @@
34 20
                ReferencedContainer = "container:example.xcodeproj">
35 21
             </BuildableReference>
36 22
          </BuildActionEntry>
37
-         <BuildActionEntry
38
-            buildForTesting = "YES"
39
-            buildForRunning = "YES"
40
-            buildForProfiling = "NO"
41
-            buildForArchiving = "NO"
42
-            buildForAnalyzing = "YES">
43
-            <BuildableReference
44
-               BuildableIdentifier = "primary"
45
-               BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
46
-               BuildableName = "example-tvOSTests.xctest"
47
-               BlueprintName = "example-tvOSTests"
48
-               ReferencedContainer = "container:example.xcodeproj">
49
-            </BuildableReference>
50
-         </BuildActionEntry>
51 23
       </BuildActionEntries>
52 24
    </BuildAction>
53 25
    <TestAction
@@ -67,17 +39,6 @@
67 39
             </BuildableReference>
68 40
          </TestableReference>
69 41
       </Testables>
70
-      <MacroExpansion>
71
-         <BuildableReference
72
-            BuildableIdentifier = "primary"
73
-            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
74
-            BuildableName = "example-tvOS.app"
75
-            BlueprintName = "example-tvOS"
76
-            ReferencedContainer = "container:example.xcodeproj">
77
-         </BuildableReference>
78
-      </MacroExpansion>
79
-      <AdditionalOptions>
80
-      </AdditionalOptions>
81 42
    </TestAction>
82 43
    <LaunchAction
83 44
       buildConfiguration = "Debug"
@@ -99,8 +60,6 @@
99 60
             ReferencedContainer = "container:example.xcodeproj">
100 61
          </BuildableReference>
101 62
       </BuildableProductRunnable>
102
-      <AdditionalOptions>
103
-      </AdditionalOptions>
104 63
    </LaunchAction>
105 64
    <ProfileAction
106 65
       buildConfiguration = "Release"

+ 2
- 43
example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme Zobrazit soubor

@@ -1,25 +1,11 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <Scheme
3
-   LastUpgradeVersion = "0940"
3
+   LastUpgradeVersion = "1130"
4 4
    version = "1.3">
5 5
    <BuildAction
6
-      parallelizeBuildables = "NO"
6
+      parallelizeBuildables = "YES"
7 7
       buildImplicitDependencies = "YES">
8 8
       <BuildActionEntries>
9
-         <BuildActionEntry
10
-            buildForTesting = "YES"
11
-            buildForRunning = "YES"
12
-            buildForProfiling = "YES"
13
-            buildForArchiving = "YES"
14
-            buildForAnalyzing = "YES">
15
-            <BuildableReference
16
-               BuildableIdentifier = "primary"
17
-               BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
18
-               BuildableName = "libReact.a"
19
-               BlueprintName = "React"
20
-               ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
-            </BuildableReference>
22
-         </BuildActionEntry>
23 9
          <BuildActionEntry
24 10
             buildForTesting = "YES"
25 11
             buildForRunning = "YES"
@@ -34,20 +20,6 @@
34 20
                ReferencedContainer = "container:example.xcodeproj">
35 21
             </BuildableReference>
36 22
          </BuildActionEntry>
37
-         <BuildActionEntry
38
-            buildForTesting = "YES"
39
-            buildForRunning = "YES"
40
-            buildForProfiling = "NO"
41
-            buildForArchiving = "NO"
42
-            buildForAnalyzing = "YES">
43
-            <BuildableReference
44
-               BuildableIdentifier = "primary"
45
-               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
46
-               BuildableName = "exampleTests.xctest"
47
-               BlueprintName = "exampleTests"
48
-               ReferencedContainer = "container:example.xcodeproj">
49
-            </BuildableReference>
50
-         </BuildActionEntry>
51 23
       </BuildActionEntries>
52 24
    </BuildAction>
53 25
    <TestAction
@@ -67,17 +39,6 @@
67 39
             </BuildableReference>
68 40
          </TestableReference>
69 41
       </Testables>
70
-      <MacroExpansion>
71
-         <BuildableReference
72
-            BuildableIdentifier = "primary"
73
-            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
74
-            BuildableName = "example.app"
75
-            BlueprintName = "example"
76
-            ReferencedContainer = "container:example.xcodeproj">
77
-         </BuildableReference>
78
-      </MacroExpansion>
79
-      <AdditionalOptions>
80
-      </AdditionalOptions>
81 42
    </TestAction>
82 43
    <LaunchAction
83 44
       buildConfiguration = "Debug"
@@ -99,8 +60,6 @@
99 60
             ReferencedContainer = "container:example.xcodeproj">
100 61
          </BuildableReference>
101 62
       </BuildableProductRunnable>
102
-      <AdditionalOptions>
103
-      </AdditionalOptions>
104 63
    </LaunchAction>
105 64
    <ProfileAction
106 65
       buildConfiguration = "Release"

+ 42
- 0
example/macos/Podfile Zobrazit soubor

@@ -0,0 +1,42 @@
1
+require_relative '../../node_modules/@react-native-community/cli-platform-ios/native_modules'
2
+
3
+abstract_target 'Shared' do
4
+  use_native_modules!
5
+
6
+  pod 'react-native-webview', :path => "../.."
7
+
8
+  pod 'React', :path => "../../node_modules/react-native-macos/"
9
+  pod 'React-Core', :path => "../../node_modules/react-native-macos/React"
10
+  pod 'React-fishhook', :path => "../../node_modules/react-native-macos/Libraries/fishhook"
11
+  pod 'React-RCTActionSheet', :path => "../../node_modules/react-native-macos/Libraries/ActionSheetIOS"
12
+  pod 'React-RCTAnimation', :path => "../../node_modules/react-native-macos/Libraries/NativeAnimation"
13
+  pod 'React-RCTBlob', :path => "../../node_modules/react-native-macos/Libraries/Blob"
14
+  pod 'React-RCTImage', :path => "../../node_modules/react-native-macos/Libraries/Image"
15
+  pod 'React-RCTLinking', :path => "../../node_modules/react-native-macos/Libraries/LinkingIOS"
16
+  pod 'React-RCTNetwork', :path => "../../node_modules/react-native-macos/Libraries/Network"
17
+  pod 'React-RCTSettings', :path => "../../node_modules/react-native-macos/Libraries/Settings"
18
+  pod 'React-RCTText', :path => "../../node_modules/react-native-macos/Libraries/Text"
19
+  pod 'React-RCTVibration', :path => "../../node_modules/react-native-macos/Libraries/Vibration"
20
+  pod 'React-RCTWebSocket', :path => "../../node_modules/react-native-macos/Libraries/WebSocket"
21
+  pod 'React-cxxreact', :path => "../../node_modules/react-native-macos/ReactCommon/cxxreact"
22
+  pod 'React-jscallinvoker', :path => "../../node_modules/react-native-macos/ReactCommon/jscallinvoker"
23
+  pod 'React-jsi', :path => "../../node_modules/react-native-macos/ReactCommon/jsi"
24
+  pod 'React-jsiexecutor', :path => "../../node_modules/react-native-macos/ReactCommon/jsiexecutor"
25
+  pod 'React-jsinspector', :path => "../../node_modules/react-native-macos/ReactCommon/jsinspector"
26
+  pod 'yoga', :path => "../../node_modules/react-native-macos/ReactCommon/yoga"
27
+  pod 'DoubleConversion', :podspec => "../../node_modules/react-native-macos/third-party-podspecs/DoubleConversion.podspec"
28
+  pod 'glog', :podspec => "../../node_modules/react-native-macos/third-party-podspecs/glog.podspec"
29
+  pod 'Folly', :podspec => "../../node_modules/react-native-macos/third-party-podspecs/Folly.podspec"
30
+  pod 'boost-for-react-native', :podspec => "../../node_modules/react-native-macos/third-party-podspecs/boost-for-react-native.podspec"
31
+  pod 'React-DevSupport', :path => "../../node_modules/react-native-macos/React"
32
+
33
+  target 'example-macOS' do
34
+    platform :macos, '10.14'
35
+    # Pods specifically for macOS target
36
+  end
37
+
38
+  target 'example-iOS' do
39
+    platform :ios, '9'
40
+    # Pods specifically for iOS target
41
+  end
42
+end

+ 199
- 0
example/macos/Podfile.lock Zobrazit soubor

@@ -0,0 +1,199 @@
1
+PODS:
2
+  - boost-for-react-native (1.63.0)
3
+  - DoubleConversion (1.1.6)
4
+  - Folly (2018.10.22.00):
5
+    - boost-for-react-native
6
+    - DoubleConversion
7
+    - Folly/Default (= 2018.10.22.00)
8
+    - glog
9
+  - Folly/Default (2018.10.22.00):
10
+    - boost-for-react-native
11
+    - DoubleConversion
12
+    - glog
13
+  - glog (0.3.5)
14
+  - React (0.60.0-microsoft.73):
15
+    - React-Core (= 0.60.0-microsoft.73)
16
+    - React-DevSupport (= 0.60.0-microsoft.73)
17
+    - React-RCTActionSheet (= 0.60.0-microsoft.73)
18
+    - React-RCTAnimation (= 0.60.0-microsoft.73)
19
+    - React-RCTBlob (= 0.60.0-microsoft.73)
20
+    - React-RCTImage (= 0.60.0-microsoft.73)
21
+    - React-RCTLinking (= 0.60.0-microsoft.73)
22
+    - React-RCTNetwork (= 0.60.0-microsoft.73)
23
+    - React-RCTSettings (= 0.60.0-microsoft.73)
24
+    - React-RCTText (= 0.60.0-microsoft.73)
25
+    - React-RCTVibration (= 0.60.0-microsoft.73)
26
+    - React-RCTWebSocket (= 0.60.0-microsoft.73)
27
+  - React-Core (0.60.0-microsoft.73):
28
+    - Folly (= 2018.10.22.00)
29
+    - React-cxxreact (= 0.60.0-microsoft.73)
30
+    - React-jsiexecutor (= 0.60.0-microsoft.73)
31
+    - yoga (= 0.60.0-microsoft.73.React)
32
+  - React-cxxreact (0.60.0-microsoft.73):
33
+    - boost-for-react-native (= 1.63.0)
34
+    - DoubleConversion
35
+    - Folly (= 2018.10.22.00)
36
+    - glog
37
+    - React-jsinspector (= 0.60.0-microsoft.73)
38
+  - React-DevSupport (0.60.0-microsoft.73):
39
+    - React-Core (= 0.60.0-microsoft.73)
40
+    - React-RCTWebSocket (= 0.60.0-microsoft.73)
41
+  - React-fishhook (0.60.0-microsoft.73)
42
+  - React-jscallinvoker (0.60.0-microsoft.73):
43
+    - Folly (= 2018.10.22.00)
44
+    - React-cxxreact (= 0.60.0-microsoft.73)
45
+  - React-jsi (0.60.0-microsoft.73):
46
+    - boost-for-react-native (= 1.63.0)
47
+    - DoubleConversion
48
+    - Folly (= 2018.10.22.00)
49
+    - glog
50
+    - React-jsi/Default (= 0.60.0-microsoft.73)
51
+  - React-jsi/Default (0.60.0-microsoft.73):
52
+    - boost-for-react-native (= 1.63.0)
53
+    - DoubleConversion
54
+    - Folly (= 2018.10.22.00)
55
+    - glog
56
+  - React-jsiexecutor (0.60.0-microsoft.73):
57
+    - DoubleConversion
58
+    - Folly (= 2018.10.22.00)
59
+    - glog
60
+    - React-cxxreact (= 0.60.0-microsoft.73)
61
+    - React-jsi (= 0.60.0-microsoft.73)
62
+  - React-jsinspector (0.60.0-microsoft.73)
63
+  - react-native-webview (9.2.1):
64
+    - React
65
+  - React-RCTActionSheet (0.60.0-microsoft.73):
66
+    - React-Core (= 0.60.0-microsoft.73)
67
+  - React-RCTAnimation (0.60.0-microsoft.73):
68
+    - React-Core (= 0.60.0-microsoft.73)
69
+  - React-RCTBlob (0.60.0-microsoft.73):
70
+    - React-Core (= 0.60.0-microsoft.73)
71
+    - React-RCTNetwork (= 0.60.0-microsoft.73)
72
+    - React-RCTWebSocket (= 0.60.0-microsoft.73)
73
+  - React-RCTImage (0.60.0-microsoft.73):
74
+    - React-Core (= 0.60.0-microsoft.73)
75
+    - React-RCTNetwork (= 0.60.0-microsoft.73)
76
+  - React-RCTLinking (0.60.0-microsoft.73):
77
+    - React-Core (= 0.60.0-microsoft.73)
78
+  - React-RCTNetwork (0.60.0-microsoft.73):
79
+    - React-Core (= 0.60.0-microsoft.73)
80
+  - React-RCTSettings (0.60.0-microsoft.73):
81
+    - React-Core (= 0.60.0-microsoft.73)
82
+  - React-RCTText (0.60.0-microsoft.73):
83
+    - React-Core (= 0.60.0-microsoft.73)
84
+  - React-RCTVibration (0.60.0-microsoft.73):
85
+    - React-Core (= 0.60.0-microsoft.73)
86
+  - React-RCTWebSocket (0.60.0-microsoft.73):
87
+    - React-Core (= 0.60.0-microsoft.73)
88
+    - React-fishhook (= 0.60.0-microsoft.73)
89
+  - yoga (0.60.0-microsoft.73.React)
90
+
91
+DEPENDENCIES:
92
+  - boost-for-react-native (from `../../node_modules/react-native-macos/third-party-podspecs/boost-for-react-native.podspec`)
93
+  - DoubleConversion (from `../../node_modules/react-native-macos/third-party-podspecs/DoubleConversion.podspec`)
94
+  - Folly (from `../../node_modules/react-native-macos/third-party-podspecs/Folly.podspec`)
95
+  - glog (from `../../node_modules/react-native-macos/third-party-podspecs/glog.podspec`)
96
+  - React (from `../../node_modules/react-native-macos/`)
97
+  - React-Core (from `../../node_modules/react-native-macos/React`)
98
+  - React-cxxreact (from `../../node_modules/react-native-macos/ReactCommon/cxxreact`)
99
+  - React-DevSupport (from `../../node_modules/react-native-macos/React`)
100
+  - React-fishhook (from `../../node_modules/react-native-macos/Libraries/fishhook`)
101
+  - React-jscallinvoker (from `../../node_modules/react-native-macos/ReactCommon/jscallinvoker`)
102
+  - React-jsi (from `../../node_modules/react-native-macos/ReactCommon/jsi`)
103
+  - React-jsiexecutor (from `../../node_modules/react-native-macos/ReactCommon/jsiexecutor`)
104
+  - React-jsinspector (from `../../node_modules/react-native-macos/ReactCommon/jsinspector`)
105
+  - react-native-webview (from `../..`)
106
+  - React-RCTActionSheet (from `../../node_modules/react-native-macos/Libraries/ActionSheetIOS`)
107
+  - React-RCTAnimation (from `../../node_modules/react-native-macos/Libraries/NativeAnimation`)
108
+  - React-RCTBlob (from `../../node_modules/react-native-macos/Libraries/Blob`)
109
+  - React-RCTImage (from `../../node_modules/react-native-macos/Libraries/Image`)
110
+  - React-RCTLinking (from `../../node_modules/react-native-macos/Libraries/LinkingIOS`)
111
+  - React-RCTNetwork (from `../../node_modules/react-native-macos/Libraries/Network`)
112
+  - React-RCTSettings (from `../../node_modules/react-native-macos/Libraries/Settings`)
113
+  - React-RCTText (from `../../node_modules/react-native-macos/Libraries/Text`)
114
+  - React-RCTVibration (from `../../node_modules/react-native-macos/Libraries/Vibration`)
115
+  - React-RCTWebSocket (from `../../node_modules/react-native-macos/Libraries/WebSocket`)
116
+  - yoga (from `../../node_modules/react-native-macos/ReactCommon/yoga`)
117
+
118
+EXTERNAL SOURCES:
119
+  boost-for-react-native:
120
+    :podspec: "../../node_modules/react-native-macos/third-party-podspecs/boost-for-react-native.podspec"
121
+  DoubleConversion:
122
+    :podspec: "../../node_modules/react-native-macos/third-party-podspecs/DoubleConversion.podspec"
123
+  Folly:
124
+    :podspec: "../../node_modules/react-native-macos/third-party-podspecs/Folly.podspec"
125
+  glog:
126
+    :podspec: "../../node_modules/react-native-macos/third-party-podspecs/glog.podspec"
127
+  React:
128
+    :path: "../../node_modules/react-native-macos/"
129
+  React-Core:
130
+    :path: "../../node_modules/react-native-macos/React"
131
+  React-cxxreact:
132
+    :path: "../../node_modules/react-native-macos/ReactCommon/cxxreact"
133
+  React-DevSupport:
134
+    :path: "../../node_modules/react-native-macos/React"
135
+  React-fishhook:
136
+    :path: "../../node_modules/react-native-macos/Libraries/fishhook"
137
+  React-jscallinvoker:
138
+    :path: "../../node_modules/react-native-macos/ReactCommon/jscallinvoker"
139
+  React-jsi:
140
+    :path: "../../node_modules/react-native-macos/ReactCommon/jsi"
141
+  React-jsiexecutor:
142
+    :path: "../../node_modules/react-native-macos/ReactCommon/jsiexecutor"
143
+  React-jsinspector:
144
+    :path: "../../node_modules/react-native-macos/ReactCommon/jsinspector"
145
+  react-native-webview:
146
+    :path: "../.."
147
+  React-RCTActionSheet:
148
+    :path: "../../node_modules/react-native-macos/Libraries/ActionSheetIOS"
149
+  React-RCTAnimation:
150
+    :path: "../../node_modules/react-native-macos/Libraries/NativeAnimation"
151
+  React-RCTBlob:
152
+    :path: "../../node_modules/react-native-macos/Libraries/Blob"
153
+  React-RCTImage:
154
+    :path: "../../node_modules/react-native-macos/Libraries/Image"
155
+  React-RCTLinking:
156
+    :path: "../../node_modules/react-native-macos/Libraries/LinkingIOS"
157
+  React-RCTNetwork:
158
+    :path: "../../node_modules/react-native-macos/Libraries/Network"
159
+  React-RCTSettings:
160
+    :path: "../../node_modules/react-native-macos/Libraries/Settings"
161
+  React-RCTText:
162
+    :path: "../../node_modules/react-native-macos/Libraries/Text"
163
+  React-RCTVibration:
164
+    :path: "../../node_modules/react-native-macos/Libraries/Vibration"
165
+  React-RCTWebSocket:
166
+    :path: "../../node_modules/react-native-macos/Libraries/WebSocket"
167
+  yoga:
168
+    :path: "../../node_modules/react-native-macos/ReactCommon/yoga"
169
+
170
+SPEC CHECKSUMS:
171
+  boost-for-react-native: a110407d9db2642fd2e1bcd7c5a51c81f2521dc9
172
+  DoubleConversion: a1bc12a74baa397a2609e0f10e19b8062d864053
173
+  Folly: feff29ba9d0b7c2e4f793a94942831d6cc5bbad7
174
+  glog: b3f6d74f3e2d33396addc0ee724d2b2b79fc3e00
175
+  React: 4d79a1cdf3230e04aca581c25efee08da1ee5164
176
+  React-Core: 13ba8f1abdf6bcd5ff0f483a9ef7a2db9a107f0e
177
+  React-cxxreact: 11924907362f4cac7420b882760f939eb126ea26
178
+  React-DevSupport: ad7a5fc590659aeccfbf865fc4a134b70436d648
179
+  React-fishhook: 4990f5c5822d79c7ab3fb76c79ac17d09bee9336
180
+  React-jscallinvoker: 3a2e5ca0f66931ede7f55dfa2c3678983b668e86
181
+  React-jsi: 62b3cdf6e9a83d5c18dcf7dc895a362fb4b7853b
182
+  React-jsiexecutor: 8bd40a456b96ac807634225efa05ac2c35894dd0
183
+  React-jsinspector: c549193caebd0004cf2df489c57c5a24614c5516
184
+  react-native-webview: d75854c6508447f78d548dbdfbfc9a2049c3b1c5
185
+  React-RCTActionSheet: 7d7c2282c5a782e7a13f8da967eb2fe6ba296847
186
+  React-RCTAnimation: 289ab0e35a77a2f585fd2743b6abf7d52fac7a5b
187
+  React-RCTBlob: fff2b91fe158a258b72e610d5e0f77db4e059bef
188
+  React-RCTImage: cc560497ac826ca385dff28e631233ec8d1b95a6
189
+  React-RCTLinking: 6d4ed366a86755fba71a0446e5ee33e9944d8c0a
190
+  React-RCTNetwork: 15ce6970143dd7883db946b97d822098a1f9fc98
191
+  React-RCTSettings: 4729f1553af00f2f073a3e4a9743e6d35578afd6
192
+  React-RCTText: e5c12c5085188057d606c6627d8022c9983226b8
193
+  React-RCTVibration: 19f2176d53ccf811cc56dc333e538ae2f3a3822c
194
+  React-RCTWebSocket: ed4f366970f1cb6280a2edf6402aaebb224cd5ef
195
+  yoga: 94752fd7c7be3ab04256ef648abc656f52d77501
196
+
197
+PODFILE CHECKSUM: 57ba7807ee34b3b25a5ef3497860eaf96be05af7
198
+
199
+COCOAPODS: 1.8.4

example/macos/example/AppDelegate.h → example/macos/example-iOS/AppDelegate.h Zobrazit soubor

@@ -1,10 +1,3 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8 1
 #import <React/RCTBridgeDelegate.h>
9 2
 #import <UIKit/UIKit.h>
10 3
 

example/macos/example/AppDelegate.m → example/macos/example-iOS/AppDelegate.m Zobrazit soubor

@@ -1,10 +1,3 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8 1
 #import "AppDelegate.h"
9 2
 
10 3
 #import <React/RCTBridge.h>

example/macos/example/Base.lproj/LaunchScreen.xib → example/macos/example-iOS/Base.lproj/LaunchScreen.xib Zobrazit soubor


example/macos/example/Images.xcassets/AppIcon.appiconset/Contents.json → example/macos/example-iOS/Images.xcassets/AppIcon.appiconset/Contents.json Zobrazit soubor

@@ -1,15 +1,5 @@
1 1
 {
2 2
   "images" : [
3
-    {
4
-      "idiom" : "iphone",
5
-      "size" : "20x20",
6
-      "scale" : "2x"
7
-    },
8
-    {
9
-      "idiom" : "iphone",
10
-      "size" : "20x20",
11
-      "scale" : "3x"
12
-    },
13 3
     {
14 4
       "idiom" : "iphone",
15 5
       "size" : "29x29",
@@ -39,11 +29,6 @@
39 29
       "idiom" : "iphone",
40 30
       "size" : "60x60",
41 31
       "scale" : "3x"
42
-    },
43
-    {
44
-      "idiom" : "ios-marketing",
45
-      "size" : "1024x1024",
46
-      "scale" : "1x"
47 32
     }
48 33
   ],
49 34
   "info" : {

example/macos/example/Images.xcassets/Contents.json → example/macos/example-iOS/Images.xcassets/Contents.json Zobrazit soubor


example/macos/example/Info.plist → example/macos/example-iOS/Info.plist Zobrazit soubor

@@ -5,7 +5,7 @@
5 5
 	<key>CFBundleDevelopmentRegion</key>
6 6
 	<string>en</string>
7 7
 	<key>CFBundleDisplayName</key>
8
-	<string>example</string>
8
+	<string>$(PRODUCT_NAME)</string>
9 9
 	<key>CFBundleExecutable</key>
10 10
 	<string>$(EXECUTABLE_NAME)</string>
11 11
 	<key>CFBundleIdentifier</key>

example/macos/example/main.m → example/macos/example-iOS/main.m Zobrazit soubor

@@ -1,10 +1,3 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8 1
 #import <UIKit/UIKit.h>
9 2
 
10 3
 #import "AppDelegate.h"

+ 0
- 7
example/macos/example-macOS/AppDelegate.h Zobrazit soubor

@@ -1,10 +1,3 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8 1
 #import <Cocoa/Cocoa.h>
9 2
 
10 3
 @class RCTBridge;

+ 0
- 7
example/macos/example-macOS/AppDelegate.m Zobrazit soubor

@@ -1,10 +1,3 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8 1
 #import "AppDelegate.h"
9 2
 
10 3
 #import <React/RCTBridge.h>

+ 58
- 0
example/macos/example-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json Zobrazit soubor

@@ -0,0 +1,58 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "mac",
5
+      "scale" : "1x",
6
+      "size" : "16x16"
7
+    },
8
+    {
9
+      "idiom" : "mac",
10
+      "scale" : "2x",
11
+      "size" : "16x16"
12
+    },
13
+    {
14
+      "idiom" : "mac",
15
+      "scale" : "1x",
16
+      "size" : "32x32"
17
+    },
18
+    {
19
+      "idiom" : "mac",
20
+      "scale" : "2x",
21
+      "size" : "32x32"
22
+    },
23
+    {
24
+      "idiom" : "mac",
25
+      "scale" : "1x",
26
+      "size" : "128x128"
27
+    },
28
+    {
29
+      "idiom" : "mac",
30
+      "scale" : "2x",
31
+      "size" : "128x128"
32
+    },
33
+    {
34
+      "idiom" : "mac",
35
+      "scale" : "1x",
36
+      "size" : "256x256"
37
+    },
38
+    {
39
+      "idiom" : "mac",
40
+      "scale" : "2x",
41
+      "size" : "256x256"
42
+    },
43
+    {
44
+      "idiom" : "mac",
45
+      "scale" : "1x",
46
+      "size" : "512x512"
47
+    },
48
+    {
49
+      "idiom" : "mac",
50
+      "scale" : "2x",
51
+      "size" : "512x512"
52
+    }
53
+  ],
54
+  "info" : {
55
+    "author" : "xcode",
56
+    "version" : 1
57
+  }
58
+}

+ 6
- 0
example/macos/example-macOS/Assets.xcassets/Contents.json Zobrazit soubor

@@ -0,0 +1,6 @@
1
+{
2
+  "info" : {
3
+    "author" : "xcode",
4
+    "version" : 1
5
+  }
6
+}

example/macos/example-macOS/Main.storyboard → example/macos/example-macOS/Base.lproj/Main.storyboard Zobrazit soubor

@@ -1,9 +1,7 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11134" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
3 3
     <dependencies>
4
-        <deployment identifier="macosx"/>
5
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15505"/>
6
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
4
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
7 5
     </dependencies>
8 6
     <scenes>
9 7
         <!--Application-->
@@ -12,11 +10,11 @@
12 10
                 <application id="hnw-xV-0zn" sceneMemberID="viewController">
13 11
                     <menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
14 12
                         <items>
15
-                            <menuItem title="rncTesterApp-macOS" id="1Xt-HY-uBw">
13
+                            <menuItem title="example" id="1Xt-HY-uBw">
16 14
                                 <modifierMask key="keyEquivalentModifierMask"/>
17
-                                <menu key="submenu" title="rncTesterApp-macOS" systemMenu="apple" id="uQy-DD-JDr">
15
+                                <menu key="submenu" title="example" systemMenu="apple" id="uQy-DD-JDr">
18 16
                                     <items>
19
-                                        <menuItem title="About rncTesterApp-macOS" id="5kV-Vb-QxS">
17
+                                        <menuItem title="About example" id="5kV-Vb-QxS">
20 18
                                             <modifierMask key="keyEquivalentModifierMask"/>
21 19
                                             <connections>
22 20
                                                 <action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
@@ -30,7 +28,7 @@
30 28
                                             <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
31 29
                                         </menuItem>
32 30
                                         <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
33
-                                        <menuItem title="Hide rncTesterApp-macOS" keyEquivalent="h" id="Olw-nP-bQN">
31
+                                        <menuItem title="Hide example" keyEquivalent="h" id="Olw-nP-bQN">
34 32
                                             <connections>
35 33
                                                 <action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68"/>
36 34
                                             </connections>
@@ -48,7 +46,7 @@
48 46
                                             </connections>
49 47
                                         </menuItem>
50 48
                                         <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
51
-                                        <menuItem title="Quit rncTesterApp-macOS" keyEquivalent="q" id="4sb-4s-VLi">
49
+                                        <menuItem title="Quit example" keyEquivalent="q" id="4sb-4s-VLi">
52 50
                                             <connections>
53 51
                                                 <action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
54 52
                                             </connections>
@@ -526,19 +524,22 @@
526 524
                                                                 <menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
527 525
                                                                     <modifierMask key="keyEquivalentModifierMask"/>
528 526
                                                                 </menuItem>
529
-                                                                <menuItem title="  Default" id="YGs-j5-SAR">
527
+                                                                <menuItem id="YGs-j5-SAR">
528
+                                                                    <string key="title">	Default</string>
530 529
                                                                     <modifierMask key="keyEquivalentModifierMask"/>
531 530
                                                                     <connections>
532 531
                                                                         <action selector="makeBaseWritingDirectionNatural:" target="Ady-hI-5gd" id="qtV-5e-UBP"/>
533 532
                                                                     </connections>
534 533
                                                                 </menuItem>
535
-                                                                <menuItem title="  Left to Right" id="Lbh-J2-qVU">
534
+                                                                <menuItem id="Lbh-J2-qVU">
535
+                                                                    <string key="title">	Left to Right</string>
536 536
                                                                     <modifierMask key="keyEquivalentModifierMask"/>
537 537
                                                                     <connections>
538 538
                                                                         <action selector="makeBaseWritingDirectionLeftToRight:" target="Ady-hI-5gd" id="S0X-9S-QSf"/>
539 539
                                                                     </connections>
540 540
                                                                 </menuItem>
541
-                                                                <menuItem title="  Right to Left" id="jFq-tB-4Kx">
541
+                                                                <menuItem id="jFq-tB-4Kx">
542
+                                                                    <string key="title">	Right to Left</string>
542 543
                                                                     <modifierMask key="keyEquivalentModifierMask"/>
543 544
                                                                     <connections>
544 545
                                                                         <action selector="makeBaseWritingDirectionRightToLeft:" target="Ady-hI-5gd" id="5fk-qB-AqJ"/>
@@ -548,19 +549,22 @@
548 549
                                                                 <menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
549 550
                                                                     <modifierMask key="keyEquivalentModifierMask"/>
550 551
                                                                 </menuItem>
551
-                                                                <menuItem title="  Default" id="Nop-cj-93Q">
552
+                                                                <menuItem id="Nop-cj-93Q">
553
+                                                                    <string key="title">	Default</string>
552 554
                                                                     <modifierMask key="keyEquivalentModifierMask"/>
553 555
                                                                     <connections>
554 556
                                                                         <action selector="makeTextWritingDirectionNatural:" target="Ady-hI-5gd" id="lPI-Se-ZHp"/>
555 557
                                                                     </connections>
556 558
                                                                 </menuItem>
557
-                                                                <menuItem title="  Left to Right" id="BgM-ve-c93">
559
+                                                                <menuItem id="BgM-ve-c93">
560
+                                                                    <string key="title">	Left to Right</string>
558 561
                                                                     <modifierMask key="keyEquivalentModifierMask"/>
559 562
                                                                     <connections>
560 563
                                                                         <action selector="makeTextWritingDirectionLeftToRight:" target="Ady-hI-5gd" id="caW-Bv-w94"/>
561 564
                                                                     </connections>
562 565
                                                                 </menuItem>
563
-                                                                <menuItem title="  Right to Left" id="RB4-Sm-HuC">
566
+                                                                <menuItem id="RB4-Sm-HuC">
567
+                                                                    <string key="title">	Right to Left</string>
564 568
                                                                     <modifierMask key="keyEquivalentModifierMask"/>
565 569
                                                                     <connections>
566 570
                                                                         <action selector="makeTextWritingDirectionRightToLeft:" target="Ady-hI-5gd" id="EXD-6r-ZUu"/>
@@ -655,7 +659,7 @@
655 659
                                 <modifierMask key="keyEquivalentModifierMask"/>
656 660
                                 <menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
657 661
                                     <items>
658
-                                        <menuItem title="rncTesterApp-macOS Help" keyEquivalent="?" id="FKE-Sm-Kum">
662
+                                        <menuItem title="example Help" keyEquivalent="?" id="FKE-Sm-Kum">
659 663
                                             <connections>
660 664
                                                 <action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no"/>
661 665
                                             </connections>
@@ -669,7 +673,7 @@
669 673
                         <outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
670 674
                     </connections>
671 675
                 </application>
672
-                <customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
676
+                <customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModuleProvider=""/>
673 677
                 <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
674 678
                 <customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
675 679
             </objects>
@@ -679,7 +683,7 @@
679 683
         <scene sceneID="R2V-B0-nI4">
680 684
             <objects>
681 685
                 <windowController id="B8D-0N-5wS" sceneMemberID="viewController">
682
-                    <window key="window" title="example macOS" allowsToolTipsWhenApplicationIsInactive="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
686
+                    <window key="window" title="example" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
683 687
                         <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
684 688
                         <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
685 689
                         <rect key="contentRect" x="196" y="240" width="480" height="270"/>
@@ -699,8 +703,8 @@
699 703
         <!--View Controller-->
700 704
         <scene sceneID="hIz-AP-VOD">
701 705
             <objects>
702
-                <viewController id="XfG-lQ-9wD" customClass="ViewController" sceneMemberID="viewController">
703
-                    <view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
706
+                <viewController id="XfG-lQ-9wD" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
707
+                    <view key="view" id="m2S-Jp-Qdl">
704 708
                         <rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
705 709
                         <autoresizingMask key="autoresizingMask"/>
706 710
                     </view>

+ 17
- 15
example/macos/example-macOS/Info.plist Zobrazit soubor

@@ -15,7 +15,7 @@
15 15
 	<key>CFBundleName</key>
16 16
 	<string>$(PRODUCT_NAME)</string>
17 17
 	<key>CFBundlePackageType</key>
18
-	<string>APPL</string>
18
+	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
19 19
 	<key>CFBundleShortVersionString</key>
20 20
 	<string>1.0</string>
21 21
 	<key>CFBundleVersion</key>
@@ -23,23 +23,25 @@
23 23
 	<key>LSMinimumSystemVersion</key>
24 24
 	<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
25 25
 	<key>NSAppTransportSecurity</key>
26
-	<dict>
27
-		<key>NSAllowsArbitraryLoads</key>
28
-		<true/>
29
-		<key>NSExceptionDomains</key>
30
-		<dict>
31
-			<key>localhost</key>
32
-			<dict>
33
-				<key>NSExceptionAllowsInsecureHTTPLoads</key>
34
-				<true/>
35
-			</dict>
36
-		</dict>
37
-	</dict>
38
-	<key>NSHumanReadableCopyright</key>
39
-	<string>Copyright © 2017 Facebook. All rights reserved.</string>
26
+ 	<dict>
27
+ 		<key>NSAllowsArbitraryLoads</key>
28
+ 		<true/>
29
+ 		<key>NSExceptionDomains</key>
30
+ 		<dict>
31
+ 			<key>localhost</key>
32
+ 			<dict>
33
+ 				<key>NSExceptionAllowsInsecureHTTPLoads</key>
34
+ 				<true/>
35
+ 			</dict>
36
+ 		</dict>
37
+ 	</dict>
40 38
 	<key>NSMainStoryboardFile</key>
41 39
 	<string>Main</string>
42 40
 	<key>NSPrincipalClass</key>
43 41
 	<string>NSApplication</string>
42
+	<key>NSSupportsAutomaticTermination</key>
43
+	<true/>
44
+	<key>NSSupportsSuddenTermination</key>
45
+	<true/>
44 46
 </dict>
45 47
 </plist>

+ 0
- 7
example/macos/example-macOS/ViewController.h Zobrazit soubor

@@ -1,10 +1,3 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8 1
 #import <Cocoa/Cocoa.h>
9 2
 
10 3
 @interface ViewController : NSViewController

+ 0
- 7
example/macos/example-macOS/ViewController.m Zobrazit soubor

@@ -1,10 +1,3 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8 1
 #import "ViewController.h"
9 2
 #import "AppDelegate.h"
10 3
 

+ 12
- 0
example/macos/example-macOS/example.entitlements Zobrazit soubor

@@ -0,0 +1,12 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>com.apple.security.app-sandbox</key>
6
+	<true/>
7
+	<key>com.apple.security.files.user-selected.read-only</key>
8
+	<true/>
9
+	<key>com.apple.security.network.client</key>
10
+	<true/>
11
+</dict>
12
+</plist>

+ 0
- 7
example/macos/example-macOS/main.m Zobrazit soubor

@@ -1,10 +1,3 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8 1
 #import <Cocoa/Cocoa.h>
9 2
 
10 3
 int main(int argc, const char *argv[]) {

+ 606
- 1569
example/macos/example.xcodeproj/project.pbxproj
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


example/macos/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme → example/macos/example.xcodeproj/xcshareddata/xcschemes/example-iOS.xcscheme Zobrazit soubor

@@ -1,25 +1,11 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <Scheme
3
-   LastUpgradeVersion = "1120"
3
+   LastUpgradeVersion = "1140"
4 4
    version = "1.3">
5 5
    <BuildAction
6
-      parallelizeBuildables = "NO"
6
+      parallelizeBuildables = "YES"
7 7
       buildImplicitDependencies = "YES">
8 8
       <BuildActionEntries>
9
-         <BuildActionEntry
10
-            buildForTesting = "YES"
11
-            buildForRunning = "YES"
12
-            buildForProfiling = "YES"
13
-            buildForArchiving = "YES"
14
-            buildForAnalyzing = "YES">
15
-            <BuildableReference
16
-               BuildableIdentifier = "primary"
17
-               BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
18
-               BuildableName = "libReact.a"
19
-               BlueprintName = "React"
20
-               ReferencedContainer = "container:../../node_modules/react-native-macos/React/React.xcodeproj">
21
-            </BuildableReference>
22
-         </BuildActionEntry>
23 9
          <BuildActionEntry
24 10
             buildForTesting = "YES"
25 11
             buildForRunning = "YES"
@@ -30,7 +16,7 @@
30 16
                BuildableIdentifier = "primary"
31 17
                BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
32 18
                BuildableName = "example.app"
33
-               BlueprintName = "example"
19
+               BlueprintName = "example-iOS"
34 20
                ReferencedContainer = "container:example.xcodeproj">
35 21
             </BuildableReference>
36 22
          </BuildActionEntry>
@@ -60,7 +46,7 @@
60 46
             BuildableIdentifier = "primary"
61 47
             BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
62 48
             BuildableName = "example.app"
63
-            BlueprintName = "example"
49
+            BlueprintName = "example-iOS"
64 50
             ReferencedContainer = "container:example.xcodeproj">
65 51
          </BuildableReference>
66 52
       </BuildableProductRunnable>
@@ -77,7 +63,7 @@
77 63
             BuildableIdentifier = "primary"
78 64
             BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
79 65
             BuildableName = "example.app"
80
-            BlueprintName = "example"
66
+            BlueprintName = "example-iOS"
81 67
             ReferencedContainer = "container:example.xcodeproj">
82 68
          </BuildableReference>
83 69
       </BuildableProductRunnable>

+ 8
- 22
example/macos/example.xcodeproj/xcshareddata/xcschemes/example-macOS.xcscheme Zobrazit soubor

@@ -1,9 +1,9 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <Scheme
3
-   LastUpgradeVersion = "1120"
3
+   LastUpgradeVersion = "1140"
4 4
    version = "1.3">
5 5
    <BuildAction
6
-      parallelizeBuildables = "NO"
6
+      parallelizeBuildables = "YES"
7 7
       buildImplicitDependencies = "YES">
8 8
       <BuildActionEntries>
9 9
          <BuildActionEntry
@@ -14,22 +14,8 @@
14 14
             buildForAnalyzing = "YES">
15 15
             <BuildableReference
16 16
                BuildableIdentifier = "primary"
17
-               BlueprintIdentifier = "6B857DA21EC51FC600A9D063"
18
-               BuildableName = "libReact.a"
19
-               BlueprintName = "React-macOS"
20
-               ReferencedContainer = "container:../../node_modules/react-native-macos/React/React.xcodeproj">
21
-            </BuildableReference>
22
-         </BuildActionEntry>
23
-         <BuildActionEntry
24
-            buildForTesting = "YES"
25
-            buildForRunning = "YES"
26
-            buildForProfiling = "YES"
27
-            buildForArchiving = "YES"
28
-            buildForAnalyzing = "YES">
29
-            <BuildableReference
30
-               BuildableIdentifier = "primary"
31
-               BlueprintIdentifier = "38C1415723BBE33000902604"
32
-               BuildableName = "example-macOS.app"
17
+               BlueprintIdentifier = "514201482437B4B30078DB4F"
18
+               BuildableName = "example.app"
33 19
                BlueprintName = "example-macOS"
34 20
                ReferencedContainer = "container:example.xcodeproj">
35 21
             </BuildableReference>
@@ -58,8 +44,8 @@
58 44
          runnableDebuggingMode = "0">
59 45
          <BuildableReference
60 46
             BuildableIdentifier = "primary"
61
-            BlueprintIdentifier = "38C1415723BBE33000902604"
62
-            BuildableName = "example-macOS.app"
47
+            BlueprintIdentifier = "514201482437B4B30078DB4F"
48
+            BuildableName = "example.app"
63 49
             BlueprintName = "example-macOS"
64 50
             ReferencedContainer = "container:example.xcodeproj">
65 51
          </BuildableReference>
@@ -75,8 +61,8 @@
75 61
          runnableDebuggingMode = "0">
76 62
          <BuildableReference
77 63
             BuildableIdentifier = "primary"
78
-            BlueprintIdentifier = "38C1415723BBE33000902604"
79
-            BuildableName = "example-macOS.app"
64
+            BlueprintIdentifier = "514201482437B4B30078DB4F"
65
+            BuildableName = "example.app"
80 66
             BlueprintName = "example-macOS"
81 67
             ReferencedContainer = "container:example.xcodeproj">
82 68
          </BuildableReference>

+ 10
- 0
example/macos/example.xcworkspace/contents.xcworkspacedata Zobrazit soubor

@@ -0,0 +1,10 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Workspace
3
+   version = "1.0">
4
+   <FileRef
5
+      location = "group:example.xcodeproj">
6
+   </FileRef>
7
+   <FileRef
8
+      location = "group:Pods/Pods.xcodeproj">
9
+   </FileRef>
10
+</Workspace>

example/macos/example.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings → example/macos/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist Zobrazit soubor

@@ -2,9 +2,7 @@
2 2
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 3
 <plist version="1.0">
4 4
 <dict>
5
-	<key>BuildSystemType</key>
6
-	<string>Original</string>
7
-	<key>PreviewsEnabled</key>
8
-	<false/>
5
+	<key>IDEDidComputeMac32BitWarning</key>
6
+	<true/>
9 7
 </dict>
10 8
 </plist>

+ 1
- 0
example/windows/.gitignore Zobrazit soubor

@@ -1,5 +1,6 @@
1 1
 *AppPackages*
2 2
 *BundleArtifacts*
3
+*Bundle
3 4
 
4 5
 #OS junk files
5 6
 [Tt]humbs.db

+ 1
- 0
example/windows/WebViewWindows.sln Zobrazit soubor

@@ -55,6 +55,7 @@ Global
55 55
 		..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9
56 56
 		..\..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
57 57
 		..\..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
58
+		..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
58 59
 		..\..\node_modules\react-native-windows\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
59 60
 		..\..\node_modules\react-native-windows\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
60 61
 	EndGlobalSection

+ 0
- 5
example/windows/WebViewWindows/App.cpp Zobrazit soubor

@@ -37,11 +37,6 @@ App::App() noexcept
37 37
     PackageProviders().Append(winrt::ReactNativeWebView::ReactPackageProvider());
38 38
 
39 39
     InitializeComponent();
40
-
41
-    // This works around a cpp/winrt bug with composable/aggregable types tracked
42
-    // by 22116519
43
-    AddRef();
44
-    m_inner.as<::IUnknown>()->Release();
45 40
 }
46 41
 
47 42
 

+ 1
- 1
example/windows/WebViewWindows/Package.appxmanifest Zobrazit soubor

@@ -7,7 +7,7 @@
7 7
   IgnorableNamespaces="uap mp">
8 8
 
9 9
  <Identity
10
-    Name="6b4ef5e9-85c1-4006-87d7-77c61c62f84f"
10
+    Name="WebViewWindows"
11 11
     Publisher="CN=kaigu"
12 12
     Version="1.0.0.0" />
13 13
 

+ 5
- 4
example/windows/WebViewWindows/WebViewWindows.vcxproj Zobrazit soubor

@@ -18,6 +18,7 @@
18 18
     <PackageCertificateKeyFile>WebViewWindows_TemporaryKey.pfx</PackageCertificateKeyFile>
19 19
     <PackageCertificateThumbprint>82A0D300B0912A62746FFB3E6E04F88985BC2798</PackageCertificateThumbprint>
20 20
     <PackageCertificatePassword>password</PackageCertificatePassword>
21
+    <AppxPackageSigningEnabled>true</AppxPackageSigningEnabled>
21 22
   </PropertyGroup>
22 23
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
23 24
   <ItemGroup Label="ProjectConfigurations">
@@ -145,6 +146,7 @@
145 146
   <ItemGroup>
146 147
     <None Include="packages.config" />
147 148
     <None Include="PropertySheet.props" />
149
+    <None Include="WebViewWindows_TemporaryKey.pfx" />
148 150
     <Text Include="readme.txt">
149 151
       <DeploymentContent>false</DeploymentContent>
150 152
     </Text>
@@ -159,12 +161,11 @@
159 161
   </ItemGroup>
160 162
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
161 163
   <PropertyGroup>
162
-    <BundleCommand>
163
-      cd $(SolutionDir)..
164
-      react-native bundle --platform windows --entry-file example/index.js --bundle-output windows/$(SolutionName)/Bundle/index.windows.bundle --assets-dest windows/$(SolutionName)/Bundle
165
-    </BundleCommand>
164
+    <BundleEntryFile>example/index.js</BundleEntryFile>
165
+    <BundlerExtraArgs>--use-react-native-windows</BundlerExtraArgs>
166 166
   </PropertyGroup>
167 167
   <Import Project="..\..\..\node_modules\react-native-windows\PropertySheets\Bundle.Cpp.targets" />
168
+  <Import Project="..\..\..\node_modules\react-native-windows\PropertySheets\Bundle.props" />
168 169
   <ImportGroup Label="ExtensionTargets">
169 170
     <Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
170 171
     <Import Project="$(SolutionDir)packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets')" />

+ 1
- 0
example/windows/WebViewWindows/WebViewWindows.vcxproj.filters Zobrazit soubor

@@ -51,6 +51,7 @@
51 51
   <ItemGroup>
52 52
     <None Include="PropertySheet.props" />
53 53
     <None Include="packages.config" />
54
+    <None Include="WebViewWindows_TemporaryKey.pfx" />
54 55
   </ItemGroup>
55 56
   <ItemGroup>
56 57
     <Text Include="readme.txt" />

+ 24
- 24
example/windows/WebViewWindows/pch.h Zobrazit soubor

@@ -1,25 +1,25 @@
1
-#pragma once
2
-
3
-#define NOMINMAX
4
-#include <hstring.h>
5
-#include <restrictederrorinfo.h>
6
-#include <unknwn.h>
7
-#include <windows.h>
8
-#include <winrt/Windows.ApplicationModel.Activation.h>
9
-#include <winrt/Windows.Foundation.Collections.h>
10
-#include <winrt/Windows.Foundation.h>
11
-#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
12
-#include <winrt/Windows.UI.Xaml.Controls.h>
13
-#include <winrt/Windows.UI.Xaml.Data.h>
14
-#include <winrt/Windows.UI.Xaml.Interop.h>
15
-#include <winrt/Windows.UI.Xaml.Markup.h>
16
-#include <winrt/Windows.UI.Xaml.Navigation.h>
17
-#include <winrt/Windows.UI.Xaml.h>
18
-
19
-#include <winrt/Microsoft.ReactNative.h>
20
-
21
-#include <winrt/Microsoft.UI.Xaml.Automation.Peers.h>
22
-#include <winrt/Microsoft.UI.Xaml.Controls.Primitives.h>
23
-#include <winrt/Microsoft.UI.Xaml.Controls.h>
24
-#include <winrt/Microsoft.UI.Xaml.Media.h>
1
+#pragma once
2
+
3
+#define NOMINMAX
4
+#include <hstring.h>
5
+#include <restrictederrorinfo.h>
6
+#include <unknwn.h>
7
+#include <windows.h>
8
+#include <winrt/Windows.ApplicationModel.Activation.h>
9
+#include <winrt/Windows.Foundation.Collections.h>
10
+#include <winrt/Windows.Foundation.h>
11
+#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
12
+#include <winrt/Windows.UI.Xaml.Controls.h>
13
+#include <winrt/Windows.UI.Xaml.Data.h>
14
+#include <winrt/Windows.UI.Xaml.Interop.h>
15
+#include <winrt/Windows.UI.Xaml.Markup.h>
16
+#include <winrt/Windows.UI.Xaml.Navigation.h>
17
+#include <winrt/Windows.UI.Xaml.h>
18
+
19
+#include <winrt/Microsoft.ReactNative.h>
20
+
21
+#include <winrt/Microsoft.UI.Xaml.Automation.Peers.h>
22
+#include <winrt/Microsoft.UI.Xaml.Controls.Primitives.h>
23
+#include <winrt/Microsoft.UI.Xaml.Controls.h>
24
+#include <winrt/Microsoft.UI.Xaml.Media.h>
25 25
 #include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h>

+ 1
- 1
index.d.ts Zobrazit soubor

@@ -2,7 +2,7 @@ import { Component } from 'react';
2 2
 // eslint-disable-next-line
3 3
 import { IOSWebViewProps, AndroidWebViewProps } from './lib/WebViewTypes';
4 4
 
5
-export { WebViewMessageEvent, WebViewNavigation } from "./lib/WebViewTypes";
5
+export { FileDownload, WebViewMessageEvent, WebViewNavigation } from "./lib/WebViewTypes";
6 6
 
7 7
 export type WebViewProps = IOSWebViewProps & AndroidWebViewProps;
8 8
 

+ 7
- 7
ios/RNCWebView.xcodeproj/project.pbxproj Zobrazit soubor

@@ -26,12 +26,12 @@
26 26
 
27 27
 /* Begin PBXFileReference section */
28 28
 		134814201AA4EA6300B7C361 /* libRNCWebView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNCWebView.a; sourceTree = BUILT_PRODUCTS_DIR; };
29
-		3515965D21A3C86000623BFA /* RNCWKProcessPoolManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNCWKProcessPoolManager.m; sourceTree = "<group>"; };
30
-		3515965F21A3C87E00623BFA /* RNCWKProcessPoolManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNCWKProcessPoolManager.h; sourceTree = "<group>"; };
31
-		E91B351921446E6C00F9801F /* RNCWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCWebViewManager.h; sourceTree = "<group>"; };
32
-		E91B351A21446E6C00F9801F /* RNCWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCWebView.h; sourceTree = "<group>"; };
33
-		E91B351B21446E6C00F9801F /* RNCWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCWebViewManager.m; sourceTree = "<group>"; };
34
-		E91B351C21446E6C00F9801F /* RNCWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCWebView.m; sourceTree = "<group>"; };
29
+		3515965D21A3C86000623BFA /* RNCWKProcessPoolManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = RNCWKProcessPoolManager.m; path = ../apple/RNCWKProcessPoolManager.m; sourceTree = "<group>"; };
30
+		3515965F21A3C87E00623BFA /* RNCWKProcessPoolManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNCWKProcessPoolManager.h; path = ../apple/RNCWKProcessPoolManager.h; sourceTree = "<group>"; };
31
+		E91B351921446E6C00F9801F /* RNCWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNCWebViewManager.h; path = ../apple/RNCWebViewManager.h; sourceTree = "<group>"; };
32
+		E91B351A21446E6C00F9801F /* RNCWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNCWebView.h; path = ../apple/RNCWebView.h; sourceTree = "<group>"; };
33
+		E91B351B21446E6C00F9801F /* RNCWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNCWebViewManager.m; path = ../apple/RNCWebViewManager.m; sourceTree = "<group>"; };
34
+		E91B351C21446E6C00F9801F /* RNCWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNCWebView.m; path = ../apple/RNCWebView.m; sourceTree = "<group>"; };
35 35
 /* End PBXFileReference section */
36 36
 
37 37
 /* Begin PBXFrameworksBuildPhase section */
@@ -60,8 +60,8 @@
60 60
 				E91B351C21446E6C00F9801F /* RNCWebView.m */,
61 61
 				E91B351921446E6C00F9801F /* RNCWebViewManager.h */,
62 62
 				E91B351B21446E6C00F9801F /* RNCWebViewManager.m */,
63
-				3515965D21A3C86000623BFA /* RNCWKProcessPoolManager.m */,
64 63
 				3515965F21A3C87E00623BFA /* RNCWKProcessPoolManager.h */,
64
+				3515965D21A3C86000623BFA /* RNCWKProcessPoolManager.m */,
65 65
 				134814211AA4EA7D00B7C361 /* Products */,
66 66
 			);
67 67
 			sourceTree = "<group>";

+ 12
- 0
jest-setups/jest.setup.js Zobrazit soubor

@@ -0,0 +1,12 @@
1
+import { windowsAppDriverCapabilities } from 'selenium-appium'
2
+
3
+switch (platform) {
4
+    case "windows":
5
+        const webViewWindowsAppId = 'WebViewWindows_3x6rhkkr9xcf6!App';
6
+        module.exports = {
7
+            capabilites: windowsAppDriverCapabilities(webViewWindowsAppId)
8
+        }
9
+        break;
10
+    default:
11
+        throw "Unknown platform: " + platform;
12
+}

+ 1
- 0
jest-setups/jest.setup.windows.js Zobrazit soubor

@@ -0,0 +1 @@
1
+platform = "windows"

+ 24
- 24
macos/RNCWebView.xcodeproj/project.pbxproj Zobrazit soubor

@@ -7,12 +7,12 @@
7 7
 	objects = {
8 8
 
9 9
 /* Begin PBXBuildFile section */
10
-		3515965E21A3C86000623BFA /* ../ios/RNCWKProcessPoolManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3515965D21A3C86000623BFA /* ../ios/RNCWKProcessPoolManager.m */; };
11
-		38116A2B23BBECB700ACE311 /* ../ios/RNCWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351B21446E6C00F9801F /* ../ios/RNCWebViewManager.m */; };
12
-		38116A2C23BBECB700ACE311 /* ../ios/RNCWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351C21446E6C00F9801F /* ../ios/RNCWebView.m */; };
13
-		38116A2D23BBECB700ACE311 /* ../ios/RNCWKProcessPoolManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3515965D21A3C86000623BFA /* ../ios/RNCWKProcessPoolManager.m */; };
14
-		E91B351D21446E6C00F9801F /* ../ios/RNCWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351B21446E6C00F9801F /* ../ios/RNCWebViewManager.m */; };
15
-		E91B351E21446E6C00F9801F /* ../ios/RNCWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351C21446E6C00F9801F /* ../ios/RNCWebView.m */; };
10
+		3515965E21A3C86000623BFA /* RNCWKProcessPoolManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3515965D21A3C86000623BFA /* RNCWKProcessPoolManager.m */; };
11
+		38116A2B23BBECB700ACE311 /* RNCWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351B21446E6C00F9801F /* RNCWebViewManager.m */; };
12
+		38116A2C23BBECB700ACE311 /* RNCWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351C21446E6C00F9801F /* RNCWebView.m */; };
13
+		38116A2D23BBECB700ACE311 /* RNCWKProcessPoolManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3515965D21A3C86000623BFA /* RNCWKProcessPoolManager.m */; };
14
+		E91B351D21446E6C00F9801F /* RNCWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351B21446E6C00F9801F /* RNCWebViewManager.m */; };
15
+		E91B351E21446E6C00F9801F /* RNCWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351C21446E6C00F9801F /* RNCWebView.m */; };
16 16
 /* End PBXBuildFile section */
17 17
 
18 18
 /* Begin PBXCopyFilesBuildPhase section */
@@ -38,13 +38,13 @@
38 38
 
39 39
 /* Begin PBXFileReference section */
40 40
 		134814201AA4EA6300B7C361 /* libRNCWebView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNCWebView.a; sourceTree = BUILT_PRODUCTS_DIR; };
41
-		3515965D21A3C86000623BFA /* ../ios/RNCWKProcessPoolManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ../ios/RNCWKProcessPoolManager.m; sourceTree = "<group>"; };
42
-		3515965F21A3C87E00623BFA /* ../ios/RNCWKProcessPoolManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ../ios/RNCWKProcessPoolManager.h; sourceTree = "<group>"; };
41
+		3515965D21A3C86000623BFA /* RNCWKProcessPoolManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = RNCWKProcessPoolManager.m; path = ../apple/RNCWKProcessPoolManager.m; sourceTree = "<group>"; };
42
+		3515965F21A3C87E00623BFA /* RNCWKProcessPoolManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNCWKProcessPoolManager.h; path = ../apple/RNCWKProcessPoolManager.h; sourceTree = "<group>"; };
43 43
 		38116A3323BBECB700ACE311 /* libRNCWebView-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRNCWebView-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
44
-		E91B351921446E6C00F9801F /* ../ios/RNCWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ../ios/RNCWebViewManager.h; sourceTree = "<group>"; };
45
-		E91B351A21446E6C00F9801F /* ../ios/RNCWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ../ios/RNCWebView.h; sourceTree = "<group>"; };
46
-		E91B351B21446E6C00F9801F /* ../ios/RNCWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ../ios/RNCWebViewManager.m; sourceTree = "<group>"; };
47
-		E91B351C21446E6C00F9801F /* ../ios/RNCWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ../ios/RNCWebView.m; sourceTree = "<group>"; };
44
+		E91B351921446E6C00F9801F /* RNCWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNCWebViewManager.h; path = ../apple/RNCWebViewManager.h; sourceTree = "<group>"; };
45
+		E91B351A21446E6C00F9801F /* RNCWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNCWebView.h; path = ../apple/RNCWebView.h; sourceTree = "<group>"; };
46
+		E91B351B21446E6C00F9801F /* RNCWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNCWebViewManager.m; path = ../apple/RNCWebViewManager.m; sourceTree = "<group>"; };
47
+		E91B351C21446E6C00F9801F /* RNCWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNCWebView.m; path = ../apple/RNCWebView.m; sourceTree = "<group>"; };
48 48
 /* End PBXFileReference section */
49 49
 
50 50
 /* Begin PBXFrameworksBuildPhase section */
@@ -76,12 +76,12 @@
76 76
 		58B511D21A9E6C8500147676 = {
77 77
 			isa = PBXGroup;
78 78
 			children = (
79
-				E91B351A21446E6C00F9801F /* ../ios/RNCWebView.h */,
80
-				E91B351C21446E6C00F9801F /* ../ios/RNCWebView.m */,
81
-				E91B351921446E6C00F9801F /* ../ios/RNCWebViewManager.h */,
82
-				E91B351B21446E6C00F9801F /* ../ios/RNCWebViewManager.m */,
83
-				3515965D21A3C86000623BFA /* ../ios/RNCWKProcessPoolManager.m */,
84
-				3515965F21A3C87E00623BFA /* ../ios/RNCWKProcessPoolManager.h */,
79
+				E91B351A21446E6C00F9801F /* RNCWebView.h */,
80
+				E91B351C21446E6C00F9801F /* RNCWebView.m */,
81
+				E91B351921446E6C00F9801F /* RNCWebViewManager.h */,
82
+				E91B351B21446E6C00F9801F /* RNCWebViewManager.m */,
83
+				3515965F21A3C87E00623BFA /* RNCWKProcessPoolManager.h */,
84
+				3515965D21A3C86000623BFA /* RNCWKProcessPoolManager.m */,
85 85
 				134814211AA4EA7D00B7C361 /* Products */,
86 86
 				38116A3323BBECB700ACE311 /* libRNCWebView-macOS.a */,
87 87
 			);
@@ -161,9 +161,9 @@
161 161
 			isa = PBXSourcesBuildPhase;
162 162
 			buildActionMask = 2147483647;
163 163
 			files = (
164
-				38116A2B23BBECB700ACE311 /* ../ios/RNCWebViewManager.m in Sources */,
165
-				38116A2C23BBECB700ACE311 /* ../ios/RNCWebView.m in Sources */,
166
-				38116A2D23BBECB700ACE311 /* ../ios/RNCWKProcessPoolManager.m in Sources */,
164
+				38116A2B23BBECB700ACE311 /* RNCWebViewManager.m in Sources */,
165
+				38116A2C23BBECB700ACE311 /* RNCWebView.m in Sources */,
166
+				38116A2D23BBECB700ACE311 /* RNCWKProcessPoolManager.m in Sources */,
167 167
 			);
168 168
 			runOnlyForDeploymentPostprocessing = 0;
169 169
 		};
@@ -171,9 +171,9 @@
171 171
 			isa = PBXSourcesBuildPhase;
172 172
 			buildActionMask = 2147483647;
173 173
 			files = (
174
-				E91B351D21446E6C00F9801F /* ../ios/RNCWebViewManager.m in Sources */,
175
-				E91B351E21446E6C00F9801F /* ../ios/RNCWebView.m in Sources */,
176
-				3515965E21A3C86000623BFA /* ../ios/RNCWKProcessPoolManager.m in Sources */,
174
+				E91B351D21446E6C00F9801F /* RNCWebViewManager.m in Sources */,
175
+				E91B351E21446E6C00F9801F /* RNCWebView.m in Sources */,
176
+				3515965E21A3C86000623BFA /* RNCWKProcessPoolManager.m in Sources */,
177 177
 			);
178 178
 			runOnlyForDeploymentPostprocessing = 0;
179 179
 		};

+ 2
- 0
metro.config.windows.js Zobrazit soubor

@@ -35,6 +35,8 @@ module.exports = {
35 35
       new RegExp(
36 36
         `${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
37 37
       ),
38
+      // Avoid error EBUSY: resource busy or locked, open '...\vnext\msbuild.ProjectImports.zip' when building 'vnext\Microsoft.ReactNative.sln' with '/bl'
39
+      /.*\.ProjectImports\.zip/,
38 40
     ]),
39 41
   },
40 42
   transformer: {

+ 90
- 86
package.json Zobrazit soubor

@@ -1,86 +1,90 @@
1
-{
2
-  "name": "react-native-webview",
3
-  "description": "React Native WebView component for iOS, Android, macOS, and Windows",
4
-  "main": "index.js",
5
-  "typings": "index.d.ts",
6
-  "author": "Jamon Holmgren <jamon@infinite.red>",
7
-  "contributors": [
8
-    "Thibault Malbranche <malbranche.thibault@gmail.com>"
9
-  ],
10
-  "license": "MIT",
11
-  "version": "9.1.1",
12
-  "homepage": "https://github.com/react-native-community/react-native-webview#readme",
13
-  "scripts": {
14
-    "start": "node node_modules/react-native/local-cli/cli.js start",
15
-    "start:android": "react-native run-android --root example/",
16
-    "start:ios": "react-native run-ios --project-path example/ios --scheme example",
17
-    "start:macos": "node node_modules/react-native-macos/local-cli/cli.js start --use-react-native-macos",
18
-    "start:windows": "react-native start --use-react-native-windows",
19
-    "ci": "CI=true && yarn lint && yarn test",
20
-    "ci:publish": "yarn semantic-release",
21
-    "lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx",
22
-    "build": "yarn tsc",
23
-    "prepare": "yarn build",
24
-    "test": "yarn jest"
25
-  },
26
-  "rn-docs": {
27
-    "title": "Webview",
28
-    "type": "Component"
29
-  },
30
-  "peerDependencies": {
31
-    "react": "^16.9",
32
-    "react-native": ">=0.60 <0.62",
33
-    "react-native-windows": "^0.61.0-beta.58"
34
-  },
35
-  "dependencies": {
36
-    "escape-string-regexp": "2.0.0",
37
-    "invariant": "2.2.4",
38
-    "rnpm-plugin-windows": "^0.5.1-0"
39
-  },
40
-  "devDependencies": {
41
-    "@babel/core": "7.4.5",
42
-    "@babel/runtime": "7.4.5",
43
-    "@react-native-community/cli": "^3.2.0",
44
-    "@react-native-community/cli-platform-android": "^3.0.0",
45
-    "@react-native-community/cli-platform-ios": "^3.0.0",
46
-    "@semantic-release/git": "7.0.16",
47
-    "@types/invariant": "^2.2.30",
48
-    "@types/jest": "24.0.18",
49
-    "@types/react": "16.8.8",
50
-    "@types/react-native": "0.60.11",
51
-    "@typescript-eslint/eslint-plugin": "2.1.0",
52
-    "@typescript-eslint/parser": "2.1.0",
53
-    "babel-eslint": "10.0.3",
54
-    "babel-jest": "24.8.0",
55
-    "babel-plugin-module-resolver": "3.1.3",
56
-    "eslint": "6.3.0",
57
-    "eslint-config-airbnb": "18.0.1",
58
-    "eslint-config-prettier": "6.2.0",
59
-    "eslint-plugin-import": "2.18.2",
60
-    "eslint-plugin-jsx-a11y": "6.2.3",
61
-    "eslint-plugin-react": "7.14.3",
62
-    "eslint-plugin-react-native": "3.7.0",
63
-    "jest": "24.9.0",
64
-    "metro-react-native-babel-preset": "0.54.1",
65
-    "react": "16.9.0",
66
-    "react-native": "0.61.5",
67
-    "react-native-macos": "0.60.0-microsoft.49",
68
-    "react-native-windows": "^0.61.0-beta.58",
69
-    "semantic-release": "15.13.24",
70
-    "typescript": "3.6.2"
71
-  },
72
-  "repository": {
73
-    "type": "git",
74
-    "url": "https://github.com/react-native-community/react-native-webview.git"
75
-  },
76
-  "files": [
77
-    "android",
78
-    "ios",
79
-    "macos",
80
-    "windows",
81
-    "lib",
82
-    "index.js",
83
-    "index.d.ts",
84
-    "react-native-webview.podspec"
85
-  ]
86
-}
1
+{
2
+  "name": "react-native-webview",
3
+  "description": "React Native WebView component for iOS, Android, macOS, and Windows",
4
+  "main": "index.js",
5
+  "typings": "index.d.ts",
6
+  "author": "Jamon Holmgren <jamon@infinite.red>",
7
+  "contributors": [
8
+    "Thibault Malbranche <malbranche.thibault@gmail.com>"
9
+  ],
10
+  "license": "MIT",
11
+  "version": "10.8.2",
12
+  "homepage": "https://github.com/react-native-community/react-native-webview#readme",
13
+  "scripts": {
14
+    "start": "node node_modules/react-native/local-cli/cli.js start",
15
+    "start:android": "react-native run-android",
16
+    "start:ios": "react-native run-ios",
17
+    "start:macos": "node node_modules/react-native-macos/local-cli/cli.js start --use-react-native-macos",
18
+    "start:windows": "react-native start --use-react-native-windows",
19
+    "ci": "CI=true && yarn lint",
20
+    "ci:publish": "yarn semantic-release",
21
+    "lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx",
22
+    "build": "yarn tsc",
23
+    "prepare": "yarn build",
24
+    "appium": "appium",
25
+    "test:windows": "yarn jest --setupFiles=./jest-setups/jest.setup.windows.js"
26
+  },
27
+  "rn-docs": {
28
+    "title": "Webview",
29
+    "type": "Component"
30
+  },
31
+  "peerDependencies": {
32
+    "react-native": ">=0.60 <0.64"
33
+  },
34
+  "dependencies": {
35
+    "escape-string-regexp": "2.0.0",
36
+    "invariant": "2.2.4"
37
+  },
38
+  "devDependencies": {
39
+    "@babel/core": "7.4.5",
40
+    "@babel/runtime": "7.4.5",
41
+    "@react-native-community/cli": "^4.8.0",
42
+    "@react-native-community/cli-platform-android": "^4.8.0",
43
+    "@react-native-community/cli-platform-ios": "^4.8.0",
44
+    "@semantic-release/git": "7.0.16",
45
+    "@types/invariant": "^2.2.30",
46
+    "@types/jest": "24.0.18",
47
+    "@types/react": "16.9.34",
48
+    "@types/react-native": "0.62.5",
49
+    "@types/selenium-webdriver": "4.0.9",
50
+    "@typescript-eslint/eslint-plugin": "2.1.0",
51
+    "@typescript-eslint/parser": "2.1.0",
52
+    "babel-eslint": "10.0.3",
53
+    "babel-jest": "24.8.0",
54
+    "babel-plugin-module-resolver": "3.1.3",
55
+    "eslint": "6.3.0",
56
+    "eslint-config-airbnb": "18.0.1",
57
+    "eslint-config-prettier": "6.2.0",
58
+    "eslint-plugin-import": "2.18.2",
59
+    "eslint-plugin-jsx-a11y": "6.2.3",
60
+    "eslint-plugin-react": "7.14.3",
61
+    "eslint-plugin-react-native": "3.7.0",
62
+    "jest": "24.9.0",
63
+    "metro": "0.56.4",
64
+    "metro-react-native-babel-preset": "^0.59.0",
65
+    "react": "16.11.0",
66
+    "react-native": "0.62.2",
67
+    "react-native-macos": "0.60.0-microsoft.73",
68
+    "react-native-windows": "^0.62.0-0",
69
+    "semantic-release": "15.13.24",
70
+    "typescript": "3.8.3",
71
+    "appium": "1.17.0",
72
+    "selenium-appium": "0.0.15",
73
+    "selenium-webdriver": "4.0.0-alpha.7"
74
+  },
75
+  "repository": {
76
+    "type": "git",
77
+    "url": "https://github.com/react-native-community/react-native-webview.git"
78
+  },
79
+  "files": [
80
+    "android",
81
+    "apple",
82
+    "ios",
83
+    "macos",
84
+    "windows",
85
+    "lib",
86
+    "index.js",
87
+    "index.d.ts",
88
+    "react-native-webview.podspec"
89
+  ]
90
+}

+ 2
- 2
react-native-webview.podspec Zobrazit soubor

@@ -10,10 +10,10 @@ Pod::Spec.new do |s|
10 10
 
11 11
   s.authors      = package['author']
12 12
   s.homepage     = package['homepage']
13
-  s.platform     = :ios, "9.0"
13
+  s.platforms    = { :ios => "9.0", :osx => "10.14" }
14 14
 
15 15
   s.source       = { :git => "https://github.com/react-native-community/react-native-webview.git", :tag => "v#{s.version}" }
16
-  s.source_files  = "ios/**/*.{h,m}"
16
+  s.source_files  = "apple/**/*.{h,m}"
17 17
 
18 18
   s.dependency 'React'
19 19
 end

+ 14
- 0
react-native.config.js Zobrazit soubor

@@ -15,6 +15,8 @@
15 15
  */
16 16
 'use strict';
17 17
 
18
+const path = require('path');
19
+
18 20
 const macSwitch = '--use-react-native-macos';
19 21
 const windowsSwitch = '--use-react-native-windows';
20 22
 
@@ -31,4 +33,16 @@ else if (process.argv.includes(windowsSwitch)) {
31 33
   module.exports = {
32 34
     reactNativePath: 'node_modules/react-native-windows',
33 35
   };
36
+}
37
+else {
38
+  module.exports = {
39
+    project: {
40
+      ios: {
41
+        project: 'example/ios/',
42
+      },
43
+      android: {
44
+        sourceDir: 'example/android',
45
+      },
46
+    },
47
+  };
34 48
 }

+ 28
- 5
src/WebView.android.tsx Zobrazit soubor

@@ -21,6 +21,7 @@ import {
21 21
   defaultRenderLoading,
22 22
 } from './WebViewShared';
23 23
 import {
24
+  WebViewRenderProcessGoneEvent,
24 25
   WebViewErrorEvent,
25 26
   WebViewHttpErrorEvent,
26 27
   WebViewMessageEvent,
@@ -41,6 +42,11 @@ const RNCWebView = requireNativeComponent(
41 42
 ) as typeof NativeWebViewAndroid;
42 43
 const { resolveAssetSource } = Image;
43 44
 
45
+/**
46
+ * A simple counter to uniquely identify WebView instances. Do not use this for anything else.
47
+ */
48
+let uniqueRef = 0;
49
+
44 50
 /**
45 51
  * Renders a native WebView.
46 52
  */
@@ -55,6 +61,7 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
55 61
     saveFormDataDisabled: false,
56 62
     cacheEnabled: true,
57 63
     androidHardwareAccelerationDisabled: false,
64
+    androidLayerType: 'none',
58 65
     originWhitelist: defaultOriginWhitelist,
59 66
   };
60 67
 
@@ -70,11 +77,15 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
70 77
     lastErrorEvent: null,
71 78
   };
72 79
 
80
+  onShouldStartLoadWithRequest: ReturnType<typeof createOnShouldStartLoadWithRequest> | null = null;
81
+
73 82
   webViewRef = React.createRef<NativeWebViewAndroid>();
74 83
 
84
+  messagingModuleName = `WebViewMessageHandler${uniqueRef+=1}`;
85
+
75 86
   componentDidMount = () => {
76
-    BatchedBridge.registerCallableModule('WebViewMessageHandler', this);
77
-  }
87
+    BatchedBridge.registerCallableModule(this.messagingModuleName, this);
88
+  };
78 89
 
79 90
   getCommands = () => UIManager.getViewManagerConfig('RNCWebView').Commands;
80 91
 
@@ -220,6 +231,13 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
220 231
     }
221 232
   }
222 233
 
234
+  onRenderProcessGone = (event: WebViewRenderProcessGoneEvent) => {
235
+    const { onRenderProcessGone } = this.props;
236
+    if (onRenderProcessGone) {
237
+      onRenderProcessGone(event);
238
+    }
239
+  }
240
+
223 241
   onLoadingFinish = (event: WebViewNavigationEvent) => {
224 242
     const { onLoad, onLoadEnd } = this.props;
225 243
     const { nativeEvent: { url } } = event;
@@ -263,8 +281,11 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
263 281
   onShouldStartLoadWithRequestCallback = (
264 282
     shouldStart: boolean,
265 283
     url: string,
284
+    lockIdentifier?: number,
266 285
   ) => {
267
-    if (shouldStart) {
286
+    if (lockIdentifier) {
287
+      NativeModules.RNCWebView.onShouldStartLoadWithRequestCallback(shouldStart, lockIdentifier);
288
+    } else if (shouldStart) {
268 289
       UIManager.dispatchViewManagerCommand(
269 290
         this.getWebViewHandle(),
270 291
         this.getCommands().loadUrl,
@@ -321,7 +342,7 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
321 342
     const NativeWebView
322 343
       = (nativeConfig.component as typeof NativeWebViewAndroid) || RNCWebView;
323 344
 
324
-    const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
345
+    this.onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
325 346
       this.onShouldStartLoadWithRequestCallback,
326 347
       // casting cause it's in the default props
327 348
       originWhitelist as readonly string[],
@@ -333,13 +354,15 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
333 354
         key="webViewKey"
334 355
         {...otherProps}
335 356
         messagingEnabled={typeof onMessage === 'function'}
357
+        messagingModuleName={this.messagingModuleName}
336 358
         onLoadingError={this.onLoadingError}
337 359
         onLoadingFinish={this.onLoadingFinish}
338 360
         onLoadingProgress={this.onLoadingProgress}
339 361
         onLoadingStart={this.onLoadingStart}
340 362
         onHttpError={this.onHttpError}
363
+        onRenderProcessGone={this.onRenderProcessGone}
341 364
         onMessage={this.onMessage}
342
-        onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
365
+        onShouldStartLoadWithRequest={this.onShouldStartLoadWithRequest}
343 366
         ref={this.webViewRef}
344 367
         // TODO: find a better way to type this.
345 368
         source={resolveAssetSource(source as ImageSourcePropType)}

+ 1
- 0
src/WebView.ios.tsx Zobrazit soubor

@@ -340,6 +340,7 @@ class WebView extends React.Component<IOSWebViewProps, State> {
340 340
         onLoadingError={this.onLoadingError}
341 341
         onLoadingFinish={this.onLoadingFinish}
342 342
         onLoadingProgress={this.onLoadingProgress}
343
+        onFileDownload={this.props.onFileDownload}
343 344
         onLoadingStart={this.onLoadingStart}
344 345
         onHttpError={this.onHttpError}
345 346
         onMessage={this.onMessage}

+ 18
- 3
src/WebView.tsx Zobrazit soubor

@@ -1,5 +1,20 @@
1
-// This files provides compatibility without tree platform.
2
-import { WebView } from 'react-native';
1
+import React from 'react';
2
+import { View } from 'react-native';
3
+import { IOSWebViewProps, AndroidWebViewProps } from './WebViewTypes';
4
+
5
+export type WebViewProps = IOSWebViewProps & AndroidWebViewProps;
6
+
7
+// This "dummy" WebView is to render something for unsupported platforms,
8
+// like for example Expo SDK "web" platform. It matches the previous react-native
9
+// implementation which is produced by Expo SDK 37.0.0.1 implementation, with
10
+// similar interface than the native ones have.
11
+const WebView: React.FunctionComponent<WebViewProps> = () => (
12
+	<View style={{
13
+		alignSelf: 'flex-start',
14
+		borderColor: 'rgb(255, 0, 0)',
15
+		borderWidth: 1
16
+	}} />
17
+);
3 18
 
4 19
 export { WebView };
5
-export default WebView;
20
+export default WebView;

+ 266
- 258
src/WebView.windows.tsx Zobrazit soubor

@@ -1,258 +1,266 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * Portions copyright for react-native-windows:
8
- *
9
- * Copyright (c) Microsoft Corporation. All rights reserved.
10
- * Licensed under the MIT License.
11
- */
12
-
13
-import React from 'react';
14
-import {
15
-  UIManager as NotTypedUIManager,
16
-  View,
17
-  requireNativeComponent,
18
-  StyleSheet,
19
-  Image,
20
-  ImageSourcePropType,
21
-  findNodeHandle,
22
-} from 'react-native';
23
-import {
24
-  createOnShouldStartLoadWithRequest,
25
-} from './WebViewShared';
26
-import {
27
-  NativeWebViewWindows,
28
-  WebViewSharedProps,
29
-  WebViewProgressEvent,
30
-  WebViewNavigationEvent,
31
-  WebViewErrorEvent,
32
-  WebViewHttpErrorEvent,
33
-  WebViewMessageEvent,
34
-  RNCWebViewUIManagerWindows,
35
-  State,
36
-} from './WebViewTypes';
37
-
38
-const UIManager = NotTypedUIManager as RNCWebViewUIManagerWindows;
39
-const { resolveAssetSource } = Image;
40
-const RCTWebView: typeof NativeWebViewWindows = requireNativeComponent(
41
-  'RCTWebView',
42
-);
43
-
44
-const styles = StyleSheet.create({
45
-  container: {
46
-    flex: 1,
47
-  },
48
-  hidden: {
49
-    height: 0,
50
-    flex: 0, // disable 'flex:1' when hiding a View
51
-  },
52
-  loadingView: {
53
-    flex: 1,
54
-    justifyContent: 'center',
55
-    alignItems: 'center',
56
-  },
57
-  loadingProgressBar: {
58
-    height: 20,
59
-  },
60
-});
61
-
62
-export default class WebView extends React.Component<WebViewSharedProps, State> {
63
-
64
-  static defaultProps = {
65
-    javaScriptEnabled: true,
66
-  };
67
-
68
-  state: State = {
69
-    viewState: this.props.startInLoadingState ? 'LOADING' : 'IDLE',
70
-    lastErrorEvent: null,
71
-  }
72
-
73
-  webViewRef = React.createRef<NativeWebViewWindows>();
74
-
75
-  goForward = () => {
76
-    UIManager.dispatchViewManagerCommand(
77
-      this.getWebViewHandle(),
78
-      UIManager.getViewManagerConfig('RCTWebView').Commands.goForward,
79
-      undefined,
80
-    );
81
-  }
82
-
83
-  goBack = () => {
84
-    UIManager.dispatchViewManagerCommand(
85
-      this.getWebViewHandle(),
86
-      UIManager.getViewManagerConfig('RCTWebView').Commands.goBack,
87
-      undefined,
88
-    );
89
-  }
90
-
91
-  reload = () => {
92
-    UIManager.dispatchViewManagerCommand(
93
-      this.getWebViewHandle(),
94
-      UIManager.getViewManagerConfig('RCTWebView').Commands.reload,
95
-      undefined,
96
-    );
97
-  }
98
-
99
-  injectJavaScript = (data: string) => {
100
-    UIManager.dispatchViewManagerCommand(
101
-      this.getWebViewHandle(),
102
-      UIManager.getViewManagerConfig('RCTWebView').Commands.injectJavaScript,
103
-      [data],
104
-    );
105
-  }
106
-
107
-  /**
108
-   * We return an event with a bunch of fields including:
109
-   *  url, title, loading, canGoBack, canGoForward
110
-   */
111
-  updateNavigationState = (event: WebViewNavigationEvent) => {
112
-    if (this.props.onNavigationStateChange) {
113
-      this.props.onNavigationStateChange(event.nativeEvent);
114
-    }
115
-  }
116
-
117
-  getWebViewHandle = () => {
118
-    // eslint-disable-next-line react/no-string-refs
119
-    return findNodeHandle(this.webViewRef.current);
120
-  }
121
-
122
-  onLoadingStart = (event: WebViewNavigationEvent) => {
123
-    const { onLoadStart } = this.props;
124
-    if(onLoadStart) {
125
-      onLoadStart(event);
126
-    }
127
-    this.updateNavigationState(event);
128
-  }
129
-
130
-  onLoadingProgress = (event: WebViewProgressEvent) => {
131
-    const { onLoadProgress } = this.props;
132
-    if (onLoadProgress) {
133
-      onLoadProgress(event);
134
-    }
135
-  };
136
-
137
-  onLoadingError = (event: WebViewErrorEvent) => {
138
-    event.persist(); // persist this event because we need to store it
139
-    const {onError, onLoadEnd} = this.props;
140
-    if(onError) {
141
-      onError(event);
142
-    }
143
-    if(onLoadEnd) {
144
-      onLoadEnd(event);
145
-    }
146
-    console.error('Encountered an error loading page', event.nativeEvent);
147
-    this.setState({
148
-      lastErrorEvent: event.nativeEvent,
149
-      viewState: 'ERROR',
150
-    });
151
-  }
152
-
153
-  onLoadingFinish =(event: WebViewNavigationEvent) => {
154
-    const {onLoad, onLoadEnd} = this.props;
155
-    if(onLoad) {
156
-      onLoad(event);
157
-    }
158
-    if(onLoadEnd) {
159
-      onLoadEnd(event);
160
-    }
161
-    this.setState({
162
-      viewState: 'IDLE',
163
-    });
164
-    this.updateNavigationState(event);
165
-  }
166
-
167
-  onMessage = (event: WebViewMessageEvent) => {
168
-    const { onMessage } = this.props;
169
-    if (onMessage) {
170
-      onMessage(event);
171
-    }
172
-  }
173
-
174
-  onHttpError = (event: WebViewHttpErrorEvent) => {
175
-    const { onHttpError } = this.props;
176
-    if (onHttpError) {
177
-      onHttpError(event);
178
-    }
179
-  }
180
-
181
-  render () {
182
-    const {
183
-      nativeConfig = {},
184
-      onMessage,
185
-      onShouldStartLoadWithRequest: onShouldStartLoadWithRequestProp,
186
-      originWhitelist,
187
-      renderError,
188
-      renderLoading,
189
-      style,
190
-      containerStyle,
191
-      ...otherProps
192
-    } = this.props;
193
-
194
-    let otherView = null;
195
-
196
-    if (this.state.viewState === 'LOADING') {
197
-      otherView = this.props.renderLoading && this.props.renderLoading();
198
-    } else if (this.state.viewState === 'ERROR') {
199
-      const errorEvent = this.state.lastErrorEvent;
200
-      otherView = this.props.renderError
201
-        && this.props.renderError(
202
-          errorEvent.domain,
203
-          errorEvent.code,
204
-          errorEvent.description,
205
-        );
206
-    } else if (this.state.viewState !== 'IDLE') {
207
-      console.error('RCTWebView invalid state encountered: ', this.state.viewState);
208
-    }
209
-
210
-    const webViewStyles = [styles.container, this.props.style];
211
-    if (
212
-      this.state.viewState === 'LOADING'
213
-      || this.state.viewState === 'ERROR'
214
-    ) {
215
-      // if we're in either LOADING or ERROR states, don't show the webView
216
-      webViewStyles.push(styles.hidden);
217
-    }
218
-
219
-    const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
220
-      ()=>{},
221
-      // casting cause it's in the default props
222
-      originWhitelist as readonly string[],
223
-      onShouldStartLoadWithRequestProp,
224
-    );
225
-
226
-    const NativeWebView
227
-    = (nativeConfig.component as typeof NativeWebViewWindows | undefined)
228
-    || RCTWebView;
229
-
230
-    const webView = (
231
-      <NativeWebView
232
-        ref={this.webViewRef}
233
-        key="webViewKey"
234
-        {...otherProps}
235
-        messagingEnabled={typeof onMessage === 'function'}
236
-        onLoadingError={this.onLoadingError}
237
-        onLoadingFinish={this.onLoadingFinish}
238
-        onLoadingProgress={this.onLoadingProgress}
239
-        onLoadingStart={this.onLoadingStart}
240
-        onHttpError={this.onHttpError}
241
-        onMessage={this.onMessage}
242
-        onScroll={this.props.onScroll}
243
-        onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
244
-        source={resolveAssetSource(this.props.source as ImageSourcePropType)}
245
-        style={webViewStyles}
246
-        {...nativeConfig.props}
247
-      />
248
-    );
249
-
250
-    return (
251
-      <View style={styles.container}>
252
-        {webView}
253
-        {otherView}
254
-      </View>
255
-    );
256
-  }
257
-
258
-}
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * Portions copyright for react-native-windows:
8
+ *
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Licensed under the MIT License.
11
+ */
12
+
13
+import React from 'react';
14
+import {
15
+  UIManager as NotTypedUIManager,
16
+  View,
17
+  requireNativeComponent,
18
+  StyleSheet,
19
+  Image,
20
+  ImageSourcePropType,
21
+  findNodeHandle,
22
+} from 'react-native';
23
+import {
24
+  createOnShouldStartLoadWithRequest,
25
+} from './WebViewShared';
26
+import {
27
+  NativeWebViewWindows,
28
+  WebViewSharedProps,
29
+  WebViewProgressEvent,
30
+  WebViewNavigationEvent,
31
+  WebViewErrorEvent,
32
+  WebViewHttpErrorEvent,
33
+  WebViewMessageEvent,
34
+  RNCWebViewUIManagerWindows,
35
+  State,
36
+} from './WebViewTypes';
37
+
38
+const UIManager = NotTypedUIManager as RNCWebViewUIManagerWindows;
39
+const { resolveAssetSource } = Image;
40
+const RCTWebView: typeof NativeWebViewWindows = requireNativeComponent(
41
+  'RCTWebView',
42
+);
43
+
44
+const styles = StyleSheet.create({
45
+  container: {
46
+    flex: 1,
47
+  },
48
+  hidden: {
49
+    height: 0,
50
+    flex: 0, // disable 'flex:1' when hiding a View
51
+  },
52
+  loadingView: {
53
+    flex: 1,
54
+    justifyContent: 'center',
55
+    alignItems: 'center',
56
+  },
57
+  loadingProgressBar: {
58
+    height: 20,
59
+  },
60
+});
61
+
62
+export default class WebView extends React.Component<WebViewSharedProps, State> {
63
+
64
+  static defaultProps = {
65
+    javaScriptEnabled: true,
66
+  };
67
+
68
+  state: State = {
69
+    viewState: this.props.startInLoadingState ? 'LOADING' : 'IDLE',
70
+    lastErrorEvent: null,
71
+  }
72
+
73
+  webViewRef = React.createRef<NativeWebViewWindows>();
74
+
75
+  goForward = () => {
76
+    UIManager.dispatchViewManagerCommand(
77
+      this.getWebViewHandle(),
78
+      UIManager.getViewManagerConfig('RCTWebView').Commands.goForward,
79
+      undefined,
80
+    );
81
+  }
82
+
83
+  goBack = () => {
84
+    UIManager.dispatchViewManagerCommand(
85
+      this.getWebViewHandle(),
86
+      UIManager.getViewManagerConfig('RCTWebView').Commands.goBack,
87
+      undefined,
88
+    );
89
+  }
90
+
91
+  reload = () => {
92
+    UIManager.dispatchViewManagerCommand(
93
+      this.getWebViewHandle(),
94
+      UIManager.getViewManagerConfig('RCTWebView').Commands.reload,
95
+      undefined,
96
+    );
97
+  }
98
+
99
+  injectJavaScript = (data: string) => {
100
+    UIManager.dispatchViewManagerCommand(
101
+      this.getWebViewHandle(),
102
+      UIManager.getViewManagerConfig('RCTWebView').Commands.injectJavaScript,
103
+      [data],
104
+    );
105
+  }
106
+
107
+  postMessage = (data: string) => {
108
+    UIManager.dispatchViewManagerCommand(
109
+      this.getWebViewHandle(),
110
+      UIManager.getViewManagerConfig('RCTWebView').Commands.postMessage,
111
+      [String(data)],
112
+    );
113
+  };
114
+
115
+  /**
116
+   * We return an event with a bunch of fields including:
117
+   *  url, title, loading, canGoBack, canGoForward
118
+   */
119
+  updateNavigationState = (event: WebViewNavigationEvent) => {
120
+    if (this.props.onNavigationStateChange) {
121
+      this.props.onNavigationStateChange(event.nativeEvent);
122
+    }
123
+  }
124
+
125
+  getWebViewHandle = () => {
126
+    // eslint-disable-next-line react/no-string-refs
127
+    return findNodeHandle(this.webViewRef.current);
128
+  }
129
+
130
+  onLoadingStart = (event: WebViewNavigationEvent) => {
131
+    const { onLoadStart } = this.props;
132
+    if(onLoadStart) {
133
+      onLoadStart(event);
134
+    }
135
+    this.updateNavigationState(event);
136
+  }
137
+
138
+  onLoadingProgress = (event: WebViewProgressEvent) => {
139
+    const { onLoadProgress } = this.props;
140
+    if (onLoadProgress) {
141
+      onLoadProgress(event);
142
+    }
143
+  };
144
+
145
+  onLoadingError = (event: WebViewErrorEvent) => {
146
+    event.persist(); // persist this event because we need to store it
147
+    const {onError, onLoadEnd} = this.props;
148
+    if(onError) {
149
+      onError(event);
150
+    }
151
+    if(onLoadEnd) {
152
+      onLoadEnd(event);
153
+    }
154
+    console.error('Encountered an error loading page', event.nativeEvent);
155
+    this.setState({
156
+      lastErrorEvent: event.nativeEvent,
157
+      viewState: 'ERROR',
158
+    });
159
+  }
160
+
161
+  onLoadingFinish =(event: WebViewNavigationEvent) => {
162
+    const {onLoad, onLoadEnd} = this.props;
163
+    if(onLoad) {
164
+      onLoad(event);
165
+    }
166
+    if(onLoadEnd) {
167
+      onLoadEnd(event);
168
+    }
169
+    this.setState({
170
+      viewState: 'IDLE',
171
+    });
172
+    this.updateNavigationState(event);
173
+  }
174
+
175
+  onMessage = (event: WebViewMessageEvent) => {
176
+    const { onMessage } = this.props;
177
+    if (onMessage) {
178
+      onMessage(event);
179
+    }
180
+  }
181
+
182
+  onHttpError = (event: WebViewHttpErrorEvent) => {
183
+    const { onHttpError } = this.props;
184
+    if (onHttpError) {
185
+      onHttpError(event);
186
+    }
187
+  }
188
+
189
+  render () {
190
+    const {
191
+      nativeConfig = {},
192
+      onMessage,
193
+      onShouldStartLoadWithRequest: onShouldStartLoadWithRequestProp,
194
+      originWhitelist,
195
+      renderError,
196
+      renderLoading,
197
+      style,
198
+      containerStyle,
199
+      ...otherProps
200
+    } = this.props;
201
+
202
+    let otherView = null;
203
+
204
+    if (this.state.viewState === 'LOADING') {
205
+      otherView = this.props.renderLoading && this.props.renderLoading();
206
+    } else if (this.state.viewState === 'ERROR') {
207
+      const errorEvent = this.state.lastErrorEvent;
208
+      otherView = this.props.renderError
209
+        && this.props.renderError(
210
+          errorEvent.domain,
211
+          errorEvent.code,
212
+          errorEvent.description,
213
+        );
214
+    } else if (this.state.viewState !== 'IDLE') {
215
+      console.error('RCTWebView invalid state encountered: ', this.state.viewState);
216
+    }
217
+
218
+    const webViewStyles = [styles.container, this.props.style];
219
+    if (
220
+      this.state.viewState === 'LOADING'
221
+      || this.state.viewState === 'ERROR'
222
+    ) {
223
+      // if we're in either LOADING or ERROR states, don't show the webView
224
+      webViewStyles.push(styles.hidden);
225
+    }
226
+
227
+    const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
228
+      ()=>{},
229
+      // casting cause it's in the default props
230
+      originWhitelist as readonly string[],
231
+      onShouldStartLoadWithRequestProp,
232
+    );
233
+
234
+    const NativeWebView
235
+    = (nativeConfig.component as typeof NativeWebViewWindows | undefined)
236
+    || RCTWebView;
237
+
238
+    const webView = (
239
+      <NativeWebView
240
+        ref={this.webViewRef}
241
+        key="webViewKey"
242
+        {...otherProps}
243
+        messagingEnabled={typeof onMessage === 'function'}
244
+        onLoadingError={this.onLoadingError}
245
+        onLoadingFinish={this.onLoadingFinish}
246
+        onLoadingProgress={this.onLoadingProgress}
247
+        onLoadingStart={this.onLoadingStart}
248
+        onHttpError={this.onHttpError}
249
+        onMessage={this.onMessage}
250
+        onScroll={this.props.onScroll}
251
+        onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
252
+        source={resolveAssetSource(this.props.source as ImageSourcePropType)}
253
+        style={webViewStyles}
254
+        {...nativeConfig.props}
255
+      />
256
+    );
257
+
258
+    return (
259
+      <View style={styles.container}>
260
+        {webView}
261
+        {otherView}
262
+      </View>
263
+    );
264
+  }
265
+
266
+}

+ 2
- 2
src/WebViewShared.tsx Zobrazit soubor

@@ -2,8 +2,8 @@ import escapeStringRegexp from 'escape-string-regexp';
2 2
 import React from 'react';
3 3
 import { Linking, View, ActivityIndicator, Text } from 'react-native';
4 4
 import {
5
-  WebViewNavigationEvent,
6 5
   OnShouldStartLoadWithRequest,
6
+  ShouldStartLoadRequestEvent,
7 7
 } from './WebViewTypes';
8 8
 import styles from './WebView.styles';
9 9
 
@@ -39,7 +39,7 @@ const createOnShouldStartLoadWithRequest = (
39 39
   originWhitelist: readonly string[],
40 40
   onShouldStartLoadWithRequest?: OnShouldStartLoadWithRequest,
41 41
 ) => {
42
-  return ({ nativeEvent }: WebViewNavigationEvent) => {
42
+  return ({ nativeEvent }: ShouldStartLoadRequestEvent) => {
43 43
     let shouldStart = true;
44 44
     const { url, lockIdentifier } = nativeEvent;
45 45
 

+ 115
- 10
src/WebViewTypes.ts Zobrazit soubor

@@ -113,6 +113,14 @@ export interface WebViewNavigation extends WebViewNativeEvent {
113 113
   mainDocumentURL?: string;
114 114
 }
115 115
 
116
+export interface ShouldStartLoadRequest extends WebViewNavigation {
117
+  isTopFrame: boolean;
118
+}
119
+
120
+export interface FileDownload {
121
+  downloadUrl: string;
122
+}
123
+
116 124
 export type DecelerationRateConstant = 'normal' | 'fast';
117 125
 
118 126
 export interface WebViewMessage extends WebViewNativeEvent {
@@ -133,6 +141,10 @@ export interface WebViewHttpError extends WebViewNativeEvent {
133 141
   statusCode: number;
134 142
 }
135 143
 
144
+export interface WebViewRenderProcessGoneDetail {
145
+  didCrash: boolean;
146
+}
147
+
136 148
 export type WebViewEvent = NativeSyntheticEvent<WebViewNativeEvent>;
137 149
 
138 150
 export type WebViewProgressEvent = NativeSyntheticEvent<
@@ -141,6 +153,10 @@ export type WebViewProgressEvent = NativeSyntheticEvent<
141 153
 
142 154
 export type WebViewNavigationEvent = NativeSyntheticEvent<WebViewNavigation>;
143 155
 
156
+export type ShouldStartLoadRequestEvent = NativeSyntheticEvent<ShouldStartLoadRequest>;
157
+
158
+export type FileDownloadEvent = NativeSyntheticEvent<FileDownload>;
159
+
144 160
 export type WebViewMessageEvent = NativeSyntheticEvent<WebViewMessage>;
145 161
 
146 162
 export type WebViewErrorEvent = NativeSyntheticEvent<WebViewError>;
@@ -149,6 +165,8 @@ export type WebViewTerminatedEvent = NativeSyntheticEvent<WebViewNativeEvent>;
149 165
 
150 166
 export type WebViewHttpErrorEvent = NativeSyntheticEvent<WebViewHttpError>;
151 167
 
168
+export type WebViewRenderProcessGoneEvent = NativeSyntheticEvent<WebViewRenderProcessGoneDetail>;
169
+
152 170
 export type DataDetectorTypes =
153 171
   | 'phoneNumber'
154 172
   | 'link'
@@ -164,6 +182,8 @@ export type OverScrollModeType = 'always' | 'content' | 'never';
164 182
 
165 183
 export type CacheMode = 'LOAD_DEFAULT' | 'LOAD_CACHE_ONLY' | 'LOAD_CACHE_ELSE_NETWORK' | 'LOAD_NO_CACHE';
166 184
 
185
+export type AndroidLayerType = 'none' | 'software' | 'hardware';
186
+
167 187
 export interface WebViewSourceUri {
168 188
   /**
169 189
    * The URI to load in the `WebView`. Can be a local or remote file.
@@ -226,7 +246,7 @@ export interface WebViewNativeConfig {
226 246
 }
227 247
 
228 248
 export type OnShouldStartLoadWithRequest = (
229
-  event: WebViewNavigation,
249
+  event: ShouldStartLoadRequest,
230 250
 ) => boolean;
231 251
 
232 252
 export interface CommonNativeWebViewProps extends ViewProps {
@@ -234,6 +254,9 @@ export interface CommonNativeWebViewProps extends ViewProps {
234 254
   incognito?: boolean;
235 255
   injectedJavaScript?: string;
236 256
   injectedJavaScriptBeforeContentLoaded?: string;
257
+  injectedJavaScriptForMainFrameOnly?: boolean;
258
+  injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
259
+  javaScriptCanOpenWindowsAutomatically?: boolean;
237 260
   mediaPlaybackRequiresUserAction?: boolean;
238 261
   messagingEnabled: boolean;
239 262
   onScroll?: (event: NativeScrollEvent) => void;
@@ -243,7 +266,7 @@ export interface CommonNativeWebViewProps extends ViewProps {
243 266
   onLoadingStart: (event: WebViewNavigationEvent) => void;
244 267
   onHttpError: (event: WebViewHttpErrorEvent) => void;
245 268
   onMessage: (event: WebViewMessageEvent) => void;
246
-  onShouldStartLoadWithRequest: (event: WebViewNavigationEvent) => void;
269
+  onShouldStartLoadWithRequest: (event: ShouldStartLoadRequestEvent) => void;
247 270
   showsHorizontalScrollIndicator?: boolean;
248 271
   showsVerticalScrollIndicator?: boolean;
249 272
   // TODO: find a better way to type this.
@@ -251,7 +274,7 @@ export interface CommonNativeWebViewProps extends ViewProps {
251 274
   source: any;
252 275
   userAgent?: string;
253 276
   /**
254
-   * Append to the existing user-agent. Overriden if `userAgent` is set.
277
+   * Append to the existing user-agent. Overridden if `userAgent` is set.
255 278
    */
256 279
   applicationNameForUserAgent?: string;
257 280
 }
@@ -263,24 +286,24 @@ export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
263 286
   allowFileAccessFromFileURLs?: boolean;
264 287
   allowUniversalAccessFromFileURLs?: boolean;
265 288
   androidHardwareAccelerationDisabled?: boolean;
289
+  androidLayerType?: AndroidLayerType;
266 290
   domStorageEnabled?: boolean;
267 291
   geolocationEnabled?: boolean;
268 292
   javaScriptEnabled?: boolean;
269 293
   mixedContentMode?: 'never' | 'always' | 'compatibility';
270 294
   onContentSizeChange?: (event: WebViewEvent) => void;
295
+  onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void;
271 296
   overScrollMode?: OverScrollModeType;
272 297
   saveFormDataDisabled?: boolean;
273 298
   textZoom?: number;
274 299
   thirdPartyCookiesEnabled?: boolean;
300
+  messagingModuleName?: string;
275 301
   readonly urlPrefixesForDefaultIntent?: string[];
276 302
 }
277 303
 
278
-export enum ContentInsetAdjustmentBehavior {
279
-  automatic = 'automatic',
280
-  scrollableAxes = 'scrollableAxes',
281
-  never = 'never',
282
-  always = 'always'
283
-};
304
+export declare type ContentInsetAdjustmentBehavior = 'automatic' | 'scrollableAxes' | 'never' | 'always';
305
+
306
+export declare type ContentMode = 'recommended' | 'mobile' | 'desktop';
284 307
 
285 308
 export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
286 309
   allowingReadAccessToURL?: string;
@@ -291,6 +314,7 @@ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
291 314
   bounces?: boolean;
292 315
   contentInset?: ContentInsetProp;
293 316
   contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior;
317
+  contentMode?: ContentMode;
294 318
   readonly dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[];
295 319
   decelerationRate?: number;
296 320
   directionalLockEnabled?: boolean;
@@ -301,6 +325,7 @@ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
301 325
   onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void;
302 326
   injectedJavaScriptForMainFrameOnly?: boolean;
303 327
   injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
328
+  onFileDownload?: (event: FileDownloadEvent) => void;
304 329
 }
305 330
 
306 331
 export interface MacOSNativeWebViewProps extends CommonNativeWebViewProps {
@@ -387,6 +412,18 @@ export interface IOSWebViewProps extends WebViewSharedProps {
387 412
    */
388 413
   contentInset?: ContentInsetProp;
389 414
 
415
+  /**
416
+   * Defaults to `recommended`, which loads mobile content on iPhone
417
+   * and iPad Mini but desktop content on other iPads.
418
+   *
419
+   * Possible values are:
420
+   * - `'recommended'`
421
+   * - `'mobile'`
422
+   * - `'desktop'`
423
+   * @platform ios
424
+   */
425
+  contentMode?: ContentMode;
426
+
390 427
   /**
391 428
    * Determines the types of data converted to clickable URLs in the web view's content.
392 429
    * By default only phone numbers are detected.
@@ -511,6 +548,33 @@ export interface IOSWebViewProps extends WebViewSharedProps {
511 548
    * @platform ios
512 549
   */
513 550
   injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
551
+
552
+  /**
553
+   * Boolean value that determines whether a pull to refresh gesture is
554
+   * available in the `WebView`. The default value is `false`.
555
+   * If `true`, sets `bounces` automatically to `true`
556
+   * @platform ios
557
+   *
558
+  */
559
+  pullToRefreshEnabled?: boolean;
560
+
561
+  /**
562
+   * Function that is invoked when the client needs to download a file.
563
+   *
564
+   * iOS 13+ only: If the webview navigates to a URL that results in an HTTP
565
+   * response with a Content-Disposition header 'attachment...', then
566
+   * this will be called.
567
+   *
568
+   * iOS 8+: If the MIME type indicates that the content is not renderable by the
569
+   * webview, that will also cause this to be called. On iOS versions before 13,
570
+   * this is the only condition that will cause this function to be called.
571
+   *
572
+   * The application will need to provide its own code to actually download
573
+   * the file.
574
+   *
575
+   * If not provided, the default is to let the webview try to render the file.
576
+   */
577
+  onFileDownload?: (event: FileDownloadEvent) => void;
514 578
 }
515 579
 
516 580
 export interface MacOSWebViewProps extends WebViewSharedProps {
@@ -654,6 +718,12 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
654 718
   onNavigationStateChange?: (event: WebViewNavigation) => void;
655 719
   onContentSizeChange?: (event: WebViewEvent) => void;
656 720
 
721
+  /**
722
+   * Function that is invoked when the `WebView` process crashes or is killed by the OS.
723
+   * Works only on Android (minimum API level 26).
724
+   */
725
+  onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void;
726
+
657 727
   /**
658 728
    * https://developer.android.com/reference/android/webkit/WebSettings.html#setCacheMode(int)
659 729
    * Set the cacheMode. Possible values are:
@@ -692,7 +762,7 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
692 762
    */
693 763
   geolocationEnabled?: boolean;
694 764
 
695
-  
765
+
696 766
   /**
697 767
    * Boolean that sets whether JavaScript running in the context of a file
698 768
    * scheme URL should be allowed to access content from other file scheme URLs.
@@ -737,6 +807,18 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
737 807
    */
738 808
   androidHardwareAccelerationDisabled?: boolean;
739 809
 
810
+    /**
811
+   * https://developer.android.com/reference/android/webkit/WebView#setLayerType(int,%20android.graphics.Paint)
812
+   * Sets the layerType. Possible values are:
813
+   *
814
+   * - `'none'` (default)
815
+   * - `'software'`
816
+   * - `'hardware'`
817
+   *
818
+   * @platform android
819
+   */
820
+  androidLayerType?: AndroidLayerType;
821
+
740 822
   /**
741 823
    * Boolean value to enable third party cookies in the `WebView`. Used on
742 824
    * Android Lollipop and above only as third party cookies are enabled by
@@ -795,6 +877,12 @@ export interface WebViewSharedProps extends ViewProps {
795 877
    */
796 878
   javaScriptEnabled?: boolean;
797 879
 
880
+  /**
881
+   * A Boolean value indicating whether JavaScript can open windows without user interaction.
882
+   * The default value is `false`.
883
+   */
884
+  javaScriptCanOpenWindowsAutomatically?: boolean;
885
+
798 886
   /**
799 887
    * Stylesheet object to set the style of the container view.
800 888
    */
@@ -882,6 +970,18 @@ export interface WebViewSharedProps extends ViewProps {
882 970
    */
883 971
   injectedJavaScriptBeforeContentLoaded?: string;
884 972
 
973
+  /**
974
+   * If `true` (default; mandatory for Android), loads the `injectedJavaScript` only into the main frame.
975
+   * If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
976
+   */
977
+  injectedJavaScriptForMainFrameOnly?: boolean;
978
+
979
+  /**
980
+   * If `true` (default; mandatory for Android), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
981
+   * If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
982
+   */
983
+  injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
984
+
885 985
   /**
886 986
    * Boolean value that determines whether a horizontal scroll indicator is
887 987
    * shown in the `WebView`. The default value is `true`.
@@ -926,4 +1026,9 @@ export interface WebViewSharedProps extends ViewProps {
926 1026
    * Should caching be enabled. Default is true.
927 1027
    */
928 1028
   cacheEnabled?: boolean;
1029
+
1030
+  /**
1031
+   * Append to the existing user-agent. Overridden if `userAgent` is set.
1032
+   */
1033
+  applicationNameForUserAgent?: string;
929 1034
 }

+ 204
- 204
windows/ReactNativeWebView.sln Zobrazit soubor

@@ -1,204 +1,204 @@
1
-
2
-Microsoft Visual Studio Solution File, Format Version 12.00
3
-# Visual Studio Version 16
4
-VisualStudioVersion = 16.0.29609.76
5
-MinimumVisualStudioVersion = 10.0.40219.1
6
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactNativeWebView", "ReactNativeWebView\ReactNativeWebView.vcxproj", "{729D9AF8-CD9E-4427-9F6C-FB757E287729}"
7
-EndProject
8
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReactNative", "ReactNative", "{6030669C-4F4D-4889-B38E-0299826D8C01}"
9
-EndProject
10
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Chakra", "..\node_modules\react-native-windows\Chakra\Chakra.vcxitems", "{C38970C0-5FBF-4D69-90D8-CBAC225AE895}"
11
-EndProject
12
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "..\node_modules\react-native-windows\Common\Common.vcxproj", "{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}"
13
-EndProject
14
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Folly", "..\node_modules\react-native-windows\Folly\Folly.vcxproj", "{A990658C-CE31-4BCC-976F-0FC6B1AF693D}"
15
-EndProject
16
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Shared", "..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems", "{0CC28589-39E4-4288-B162-97B959F8B843}"
17
-EndProject
18
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Universal", "..\node_modules\react-native-windows\JSI\Universal\JSI.Universal.vcxproj", "{A62D504A-16B8-41D2-9F19-E2E86019E5E4}"
19
-EndProject
20
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.ReactNative", "..\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj", "{F7D32BD0-2749-483E-9A0D-1635EF7E3136}"
21
-EndProject
22
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.ReactNative.Cxx", "..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems", "{DA8B35B3-DA00-4B02-BDE6-6A397B3FD46B}"
23
-EndProject
24
-Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.ReactNative.SharedManaged", "..\node_modules\react-native-windows\Microsoft.ReactNative.SharedManaged\Microsoft.ReactNative.SharedManaged.shproj", "{67A1076F-7790-4203-86EA-4402CCB5E782}"
25
-EndProject
26
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactCommon", "..\node_modules\react-native-windows\ReactCommon\ReactCommon.vcxproj", "{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}"
27
-EndProject
28
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactUWP", "..\node_modules\react-native-windows\ReactUWP\ReactUWP.vcxproj", "{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}"
29
-EndProject
30
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactWindowsCore", "..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore.vcxproj", "{11C084A3-A57C-4296-A679-CAC17B603144}"
31
-EndProject
32
-Global
33
-	GlobalSection(SharedMSBuildProjectFiles) = preSolution
34
-		..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{0cc28589-39e4-4288-b162-97b959f8b843}*SharedItemsImports = 9
35
-		..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{2d5d43d9-cffc-4c40-b4cd-02efb4e2742b}*SharedItemsImports = 4
36
-		..\node_modules\react-native-windows\Shared\Shared.vcxitems*{2d5d43d9-cffc-4c40-b4cd-02efb4e2742b}*SharedItemsImports = 4
37
-		..\node_modules\react-native-windows\Microsoft.ReactNative.SharedManaged\Microsoft.ReactNative.SharedManaged.projitems*{67a1076f-7790-4203-86ea-4402ccb5e782}*SharedItemsImports = 13
38
-		..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{729d9af8-cd9e-4427-9f6c-fb757e287729}*SharedItemsImports = 4
39
-		..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{a62d504a-16b8-41d2-9f19-e2e86019e5e4}*SharedItemsImports = 4
40
-		..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9
41
-		..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9
42
-		..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
43
-		..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
44
-		..\node_modules\react-native-windows\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
45
-		..\node_modules\react-native-windows\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
46
-	EndGlobalSection
47
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
48
-		Debug|ARM = Debug|ARM
49
-		Debug|ARM64 = Debug|ARM64
50
-		Debug|x64 = Debug|x64
51
-		Debug|x86 = Debug|x86
52
-		Release|ARM = Release|ARM
53
-		Release|ARM64 = Release|ARM64
54
-		Release|x64 = Release|x64
55
-		Release|x86 = Release|x86
56
-	EndGlobalSection
57
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
58
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|ARM.ActiveCfg = Debug|ARM
59
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|ARM.Build.0 = Debug|ARM
60
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|ARM64.ActiveCfg = Debug|Win32
61
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x64.ActiveCfg = Debug|x64
62
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x64.Build.0 = Debug|x64
63
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x86.ActiveCfg = Debug|Win32
64
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x86.Build.0 = Debug|Win32
65
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|ARM.ActiveCfg = Release|ARM
66
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|ARM.Build.0 = Release|ARM
67
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|ARM64.ActiveCfg = Release|Win32
68
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x64.ActiveCfg = Release|x64
69
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x64.Build.0 = Release|x64
70
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x86.ActiveCfg = Release|Win32
71
-		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x86.Build.0 = Release|Win32
72
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM.ActiveCfg = Debug|ARM
73
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM.Build.0 = Debug|ARM
74
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.ActiveCfg = Debug|ARM64
75
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.Build.0 = Debug|ARM64
76
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x64.ActiveCfg = Debug|x64
77
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x64.Build.0 = Debug|x64
78
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x86.ActiveCfg = Debug|Win32
79
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x86.Build.0 = Debug|Win32
80
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM.ActiveCfg = Release|ARM
81
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM.Build.0 = Release|ARM
82
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM64.ActiveCfg = Release|ARM64
83
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM64.Build.0 = Release|ARM64
84
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.ActiveCfg = Release|x64
85
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.Build.0 = Release|x64
86
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.ActiveCfg = Release|Win32
87
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.Build.0 = Release|Win32
88
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.ActiveCfg = Debug|ARM
89
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.Build.0 = Debug|ARM
90
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.ActiveCfg = Debug|ARM64
91
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.Build.0 = Debug|ARM64
92
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.ActiveCfg = Debug|x64
93
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.Build.0 = Debug|x64
94
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.ActiveCfg = Debug|Win32
95
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.Build.0 = Debug|Win32
96
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.ActiveCfg = Release|ARM
97
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.Build.0 = Release|ARM
98
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM64.ActiveCfg = Release|ARM64
99
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM64.Build.0 = Release|ARM64
100
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.ActiveCfg = Release|x64
101
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.Build.0 = Release|x64
102
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.ActiveCfg = Release|Win32
103
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.Build.0 = Release|Win32
104
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.ActiveCfg = Debug|ARM
105
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.Build.0 = Debug|ARM
106
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM64.ActiveCfg = Debug|ARM64
107
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM64.Build.0 = Debug|ARM64
108
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.ActiveCfg = Debug|x64
109
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.Build.0 = Debug|x64
110
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.ActiveCfg = Debug|Win32
111
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.Build.0 = Debug|Win32
112
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.ActiveCfg = Release|ARM
113
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.Build.0 = Release|ARM
114
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM64.ActiveCfg = Release|ARM64
115
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM64.Build.0 = Release|ARM64
116
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.ActiveCfg = Release|x64
117
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.Build.0 = Release|x64
118
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.ActiveCfg = Release|Win32
119
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.Build.0 = Release|Win32
120
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM.ActiveCfg = Debug|ARM
121
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM.Build.0 = Debug|ARM
122
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM64.ActiveCfg = Debug|ARM64
123
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM64.Build.0 = Debug|ARM64
124
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x64.ActiveCfg = Debug|x64
125
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x64.Build.0 = Debug|x64
126
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x86.ActiveCfg = Debug|Win32
127
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x86.Build.0 = Debug|Win32
128
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM.ActiveCfg = Release|ARM
129
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM.Build.0 = Release|ARM
130
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM64.ActiveCfg = Release|ARM64
131
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM64.Build.0 = Release|ARM64
132
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x64.ActiveCfg = Release|x64
133
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x64.Build.0 = Release|x64
134
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x86.ActiveCfg = Release|Win32
135
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x86.Build.0 = Release|Win32
136
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.ActiveCfg = Debug|ARM
137
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.Build.0 = Debug|ARM
138
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.ActiveCfg = Debug|ARM64
139
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.Build.0 = Debug|ARM64
140
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.ActiveCfg = Debug|x64
141
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.Build.0 = Debug|x64
142
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.ActiveCfg = Debug|Win32
143
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.Build.0 = Debug|Win32
144
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.ActiveCfg = Release|ARM
145
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.Build.0 = Release|ARM
146
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM64.ActiveCfg = Release|ARM64
147
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM64.Build.0 = Release|ARM64
148
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.ActiveCfg = Release|x64
149
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.Build.0 = Release|x64
150
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.ActiveCfg = Release|Win32
151
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.Build.0 = Release|Win32
152
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|ARM.ActiveCfg = Debug|ARM
153
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|ARM.Build.0 = Debug|ARM
154
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|ARM64.ActiveCfg = Debug|ARM64
155
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|ARM64.Build.0 = Debug|ARM64
156
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x64.ActiveCfg = Debug|x64
157
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x64.Build.0 = Debug|x64
158
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x86.ActiveCfg = Debug|Win32
159
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x86.Build.0 = Debug|Win32
160
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|ARM.ActiveCfg = Release|ARM
161
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|ARM.Build.0 = Release|ARM
162
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|ARM64.ActiveCfg = Release|ARM64
163
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|ARM64.Build.0 = Release|ARM64
164
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x64.ActiveCfg = Release|x64
165
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x64.Build.0 = Release|x64
166
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x86.ActiveCfg = Release|Win32
167
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x86.Build.0 = Release|Win32
168
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.ActiveCfg = Debug|ARM
169
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.Build.0 = Debug|ARM
170
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM64.ActiveCfg = Debug|ARM64
171
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM64.Build.0 = Debug|ARM64
172
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.ActiveCfg = Debug|x64
173
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.Build.0 = Debug|x64
174
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.ActiveCfg = Debug|Win32
175
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.Build.0 = Debug|Win32
176
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.ActiveCfg = Release|ARM
177
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.Build.0 = Release|ARM
178
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM64.ActiveCfg = Release|ARM64
179
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM64.Build.0 = Release|ARM64
180
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.ActiveCfg = Release|x64
181
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.Build.0 = Release|x64
182
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.ActiveCfg = Release|Win32
183
-		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.Build.0 = Release|Win32
184
-	EndGlobalSection
185
-	GlobalSection(SolutionProperties) = preSolution
186
-		HideSolutionNode = FALSE
187
-	EndGlobalSection
188
-	GlobalSection(NestedProjects) = preSolution
189
-		{C38970C0-5FBF-4D69-90D8-CBAC225AE895} = {6030669C-4F4D-4889-B38E-0299826D8C01}
190
-		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D} = {6030669C-4F4D-4889-B38E-0299826D8C01}
191
-		{A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {6030669C-4F4D-4889-B38E-0299826D8C01}
192
-		{0CC28589-39E4-4288-B162-97B959F8B843} = {6030669C-4F4D-4889-B38E-0299826D8C01}
193
-		{A62D504A-16B8-41D2-9F19-E2E86019E5E4} = {6030669C-4F4D-4889-B38E-0299826D8C01}
194
-		{F7D32BD0-2749-483E-9A0D-1635EF7E3136} = {6030669C-4F4D-4889-B38E-0299826D8C01}
195
-		{DA8B35B3-DA00-4B02-BDE6-6A397B3FD46B} = {6030669C-4F4D-4889-B38E-0299826D8C01}
196
-		{67A1076F-7790-4203-86EA-4402CCB5E782} = {6030669C-4F4D-4889-B38E-0299826D8C01}
197
-		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD} = {6030669C-4F4D-4889-B38E-0299826D8C01}
198
-		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B} = {6030669C-4F4D-4889-B38E-0299826D8C01}
199
-		{11C084A3-A57C-4296-A679-CAC17B603144} = {6030669C-4F4D-4889-B38E-0299826D8C01}
200
-	EndGlobalSection
201
-	GlobalSection(ExtensibilityGlobals) = postSolution
202
-		SolutionGuid = {D1E18B0A-0D27-4F39-8A8B-7E3D784A99FC}
203
-	EndGlobalSection
204
-EndGlobal
1
+
2
+Microsoft Visual Studio Solution File, Format Version 12.00
3
+# Visual Studio Version 16
4
+VisualStudioVersion = 16.0.29609.76
5
+MinimumVisualStudioVersion = 10.0.40219.1
6
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactNativeWebView", "ReactNativeWebView\ReactNativeWebView.vcxproj", "{729D9AF8-CD9E-4427-9F6C-FB757E287729}"
7
+EndProject
8
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReactNative", "ReactNative", "{6030669C-4F4D-4889-B38E-0299826D8C01}"
9
+EndProject
10
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Chakra", "..\node_modules\react-native-windows\Chakra\Chakra.vcxitems", "{C38970C0-5FBF-4D69-90D8-CBAC225AE895}"
11
+EndProject
12
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "..\node_modules\react-native-windows\Common\Common.vcxproj", "{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}"
13
+EndProject
14
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Folly", "..\node_modules\react-native-windows\Folly\Folly.vcxproj", "{A990658C-CE31-4BCC-976F-0FC6B1AF693D}"
15
+EndProject
16
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Shared", "..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems", "{0CC28589-39E4-4288-B162-97B959F8B843}"
17
+EndProject
18
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Universal", "..\node_modules\react-native-windows\JSI\Universal\JSI.Universal.vcxproj", "{A62D504A-16B8-41D2-9F19-E2E86019E5E4}"
19
+EndProject
20
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.ReactNative", "..\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj", "{F7D32BD0-2749-483E-9A0D-1635EF7E3136}"
21
+EndProject
22
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.ReactNative.Cxx", "..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems", "{DA8B35B3-DA00-4B02-BDE6-6A397B3FD46B}"
23
+EndProject
24
+Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.ReactNative.SharedManaged", "..\node_modules\react-native-windows\Microsoft.ReactNative.SharedManaged\Microsoft.ReactNative.SharedManaged.shproj", "{67A1076F-7790-4203-86EA-4402CCB5E782}"
25
+EndProject
26
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactCommon", "..\node_modules\react-native-windows\ReactCommon\ReactCommon.vcxproj", "{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}"
27
+EndProject
28
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactUWP", "..\node_modules\react-native-windows\ReactUWP\ReactUWP.vcxproj", "{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}"
29
+EndProject
30
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactWindowsCore", "..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore.vcxproj", "{11C084A3-A57C-4296-A679-CAC17B603144}"
31
+EndProject
32
+Global
33
+	GlobalSection(SharedMSBuildProjectFiles) = preSolution
34
+		..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{0cc28589-39e4-4288-b162-97b959f8b843}*SharedItemsImports = 9
35
+		..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{2d5d43d9-cffc-4c40-b4cd-02efb4e2742b}*SharedItemsImports = 4
36
+		..\node_modules\react-native-windows\Shared\Shared.vcxitems*{2d5d43d9-cffc-4c40-b4cd-02efb4e2742b}*SharedItemsImports = 4
37
+		..\node_modules\react-native-windows\Microsoft.ReactNative.SharedManaged\Microsoft.ReactNative.SharedManaged.projitems*{67a1076f-7790-4203-86ea-4402ccb5e782}*SharedItemsImports = 13
38
+		..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{729d9af8-cd9e-4427-9f6c-fb757e287729}*SharedItemsImports = 4
39
+		..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{a62d504a-16b8-41d2-9f19-e2e86019e5e4}*SharedItemsImports = 4
40
+		..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9
41
+		..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9
42
+		..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
43
+		..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
44
+		..\node_modules\react-native-windows\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
45
+		..\node_modules\react-native-windows\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
46
+	EndGlobalSection
47
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
48
+		Debug|ARM = Debug|ARM
49
+		Debug|ARM64 = Debug|ARM64
50
+		Debug|x64 = Debug|x64
51
+		Debug|x86 = Debug|x86
52
+		Release|ARM = Release|ARM
53
+		Release|ARM64 = Release|ARM64
54
+		Release|x64 = Release|x64
55
+		Release|x86 = Release|x86
56
+	EndGlobalSection
57
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
58
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|ARM.ActiveCfg = Debug|ARM
59
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|ARM.Build.0 = Debug|ARM
60
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|ARM64.ActiveCfg = Debug|Win32
61
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x64.ActiveCfg = Debug|x64
62
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x64.Build.0 = Debug|x64
63
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x86.ActiveCfg = Debug|Win32
64
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x86.Build.0 = Debug|Win32
65
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|ARM.ActiveCfg = Release|ARM
66
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|ARM.Build.0 = Release|ARM
67
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|ARM64.ActiveCfg = Release|Win32
68
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x64.ActiveCfg = Release|x64
69
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x64.Build.0 = Release|x64
70
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x86.ActiveCfg = Release|Win32
71
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x86.Build.0 = Release|Win32
72
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM.ActiveCfg = Debug|ARM
73
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM.Build.0 = Debug|ARM
74
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.ActiveCfg = Debug|ARM64
75
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.Build.0 = Debug|ARM64
76
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x64.ActiveCfg = Debug|x64
77
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x64.Build.0 = Debug|x64
78
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x86.ActiveCfg = Debug|Win32
79
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x86.Build.0 = Debug|Win32
80
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM.ActiveCfg = Release|ARM
81
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM.Build.0 = Release|ARM
82
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM64.ActiveCfg = Release|ARM64
83
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM64.Build.0 = Release|ARM64
84
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.ActiveCfg = Release|x64
85
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.Build.0 = Release|x64
86
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.ActiveCfg = Release|Win32
87
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.Build.0 = Release|Win32
88
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.ActiveCfg = Debug|ARM
89
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.Build.0 = Debug|ARM
90
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.ActiveCfg = Debug|ARM64
91
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.Build.0 = Debug|ARM64
92
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.ActiveCfg = Debug|x64
93
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.Build.0 = Debug|x64
94
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.ActiveCfg = Debug|Win32
95
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.Build.0 = Debug|Win32
96
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.ActiveCfg = Release|ARM
97
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.Build.0 = Release|ARM
98
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM64.ActiveCfg = Release|ARM64
99
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM64.Build.0 = Release|ARM64
100
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.ActiveCfg = Release|x64
101
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.Build.0 = Release|x64
102
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.ActiveCfg = Release|Win32
103
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.Build.0 = Release|Win32
104
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.ActiveCfg = Debug|ARM
105
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.Build.0 = Debug|ARM
106
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM64.ActiveCfg = Debug|ARM64
107
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM64.Build.0 = Debug|ARM64
108
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.ActiveCfg = Debug|x64
109
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.Build.0 = Debug|x64
110
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.ActiveCfg = Debug|Win32
111
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.Build.0 = Debug|Win32
112
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.ActiveCfg = Release|ARM
113
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.Build.0 = Release|ARM
114
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM64.ActiveCfg = Release|ARM64
115
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM64.Build.0 = Release|ARM64
116
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.ActiveCfg = Release|x64
117
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.Build.0 = Release|x64
118
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.ActiveCfg = Release|Win32
119
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.Build.0 = Release|Win32
120
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM.ActiveCfg = Debug|ARM
121
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM.Build.0 = Debug|ARM
122
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM64.ActiveCfg = Debug|ARM64
123
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM64.Build.0 = Debug|ARM64
124
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x64.ActiveCfg = Debug|x64
125
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x64.Build.0 = Debug|x64
126
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x86.ActiveCfg = Debug|Win32
127
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x86.Build.0 = Debug|Win32
128
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM.ActiveCfg = Release|ARM
129
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM.Build.0 = Release|ARM
130
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM64.ActiveCfg = Release|ARM64
131
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM64.Build.0 = Release|ARM64
132
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x64.ActiveCfg = Release|x64
133
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x64.Build.0 = Release|x64
134
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x86.ActiveCfg = Release|Win32
135
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x86.Build.0 = Release|Win32
136
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.ActiveCfg = Debug|ARM
137
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.Build.0 = Debug|ARM
138
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.ActiveCfg = Debug|ARM64
139
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.Build.0 = Debug|ARM64
140
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.ActiveCfg = Debug|x64
141
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.Build.0 = Debug|x64
142
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.ActiveCfg = Debug|Win32
143
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.Build.0 = Debug|Win32
144
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.ActiveCfg = Release|ARM
145
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.Build.0 = Release|ARM
146
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM64.ActiveCfg = Release|ARM64
147
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM64.Build.0 = Release|ARM64
148
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.ActiveCfg = Release|x64
149
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.Build.0 = Release|x64
150
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.ActiveCfg = Release|Win32
151
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.Build.0 = Release|Win32
152
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|ARM.ActiveCfg = Debug|ARM
153
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|ARM.Build.0 = Debug|ARM
154
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|ARM64.ActiveCfg = Debug|ARM64
155
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|ARM64.Build.0 = Debug|ARM64
156
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x64.ActiveCfg = Debug|x64
157
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x64.Build.0 = Debug|x64
158
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x86.ActiveCfg = Debug|Win32
159
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x86.Build.0 = Debug|Win32
160
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|ARM.ActiveCfg = Release|ARM
161
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|ARM.Build.0 = Release|ARM
162
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|ARM64.ActiveCfg = Release|ARM64
163
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|ARM64.Build.0 = Release|ARM64
164
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x64.ActiveCfg = Release|x64
165
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x64.Build.0 = Release|x64
166
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x86.ActiveCfg = Release|Win32
167
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x86.Build.0 = Release|Win32
168
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.ActiveCfg = Debug|ARM
169
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.Build.0 = Debug|ARM
170
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM64.ActiveCfg = Debug|ARM64
171
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM64.Build.0 = Debug|ARM64
172
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.ActiveCfg = Debug|x64
173
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.Build.0 = Debug|x64
174
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.ActiveCfg = Debug|Win32
175
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.Build.0 = Debug|Win32
176
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.ActiveCfg = Release|ARM
177
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.Build.0 = Release|ARM
178
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM64.ActiveCfg = Release|ARM64
179
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM64.Build.0 = Release|ARM64
180
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.ActiveCfg = Release|x64
181
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.Build.0 = Release|x64
182
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.ActiveCfg = Release|Win32
183
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.Build.0 = Release|Win32
184
+	EndGlobalSection
185
+	GlobalSection(SolutionProperties) = preSolution
186
+		HideSolutionNode = FALSE
187
+	EndGlobalSection
188
+	GlobalSection(NestedProjects) = preSolution
189
+		{C38970C0-5FBF-4D69-90D8-CBAC225AE895} = {6030669C-4F4D-4889-B38E-0299826D8C01}
190
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D} = {6030669C-4F4D-4889-B38E-0299826D8C01}
191
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {6030669C-4F4D-4889-B38E-0299826D8C01}
192
+		{0CC28589-39E4-4288-B162-97B959F8B843} = {6030669C-4F4D-4889-B38E-0299826D8C01}
193
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4} = {6030669C-4F4D-4889-B38E-0299826D8C01}
194
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136} = {6030669C-4F4D-4889-B38E-0299826D8C01}
195
+		{DA8B35B3-DA00-4B02-BDE6-6A397B3FD46B} = {6030669C-4F4D-4889-B38E-0299826D8C01}
196
+		{67A1076F-7790-4203-86EA-4402CCB5E782} = {6030669C-4F4D-4889-B38E-0299826D8C01}
197
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD} = {6030669C-4F4D-4889-B38E-0299826D8C01}
198
+		{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B} = {6030669C-4F4D-4889-B38E-0299826D8C01}
199
+		{11C084A3-A57C-4296-A679-CAC17B603144} = {6030669C-4F4D-4889-B38E-0299826D8C01}
200
+	EndGlobalSection
201
+	GlobalSection(ExtensibilityGlobals) = postSolution
202
+		SolutionGuid = {D1E18B0A-0D27-4F39-8A8B-7E3D784A99FC}
203
+	EndGlobalSection
204
+EndGlobal

+ 15
- 15
windows/ReactNativeWebView/PropertySheet.props Zobrazit soubor

@@ -1,16 +1,16 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
-  <ImportGroup Label="PropertySheets" />
4
-  <PropertyGroup Label="UserMacros" />
5
-  <!--
6
-    To customize common C++/WinRT project properties: 
7
-    * right-click the project node
8
-    * expand the Common Properties item
9
-    * select the C++/WinRT property page
10
-
11
-    For more advanced scenarios, and complete documentation, please see:
12
-    https://github.com/Microsoft/cppwinrt/tree/master/nuget 
13
-    -->
14
-  <PropertyGroup />
15
-  <ItemDefinitionGroup />
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <ImportGroup Label="PropertySheets" />
4
+  <PropertyGroup Label="UserMacros" />
5
+  <!--
6
+    To customize common C++/WinRT project properties: 
7
+    * right-click the project node
8
+    * expand the Common Properties item
9
+    * select the C++/WinRT property page
10
+
11
+    For more advanced scenarios, and complete documentation, please see:
12
+    https://github.com/Microsoft/cppwinrt/tree/master/nuget 
13
+    -->
14
+  <PropertyGroup />
15
+  <ItemDefinitionGroup />
16 16
 </Project>

+ 3
- 3
windows/ReactNativeWebView/ReactNativeWebView.def Zobrazit soubor

@@ -1,3 +1,3 @@
1
-EXPORTS
2
-DllCanUnloadNow = WINRT_CanUnloadNow                    PRIVATE
3
-DllGetActivationFactory = WINRT_GetActivationFactory    PRIVATE
1
+EXPORTS
2
+DllCanUnloadNow = WINRT_CanUnloadNow                    PRIVATE
3
+DllGetActivationFactory = WINRT_GetActivationFactory    PRIVATE

+ 32
- 32
windows/ReactNativeWebView/ReactNativeWebView.filters Zobrazit soubor

@@ -1,33 +1,33 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
-  <ItemGroup>
4
-    <Filter Include="Resources">
5
-      <UniqueIdentifier>accd3aa8-1ba0-4223-9bbe-0c431709210b</UniqueIdentifier>
6
-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
7
-    </Filter>
8
-    <Filter Include="Generated Files">
9
-      <UniqueIdentifier>{926ab91d-31b4-48c3-b9a4-e681349f27f0}</UniqueIdentifier>
10
-    </Filter>
11
-  </ItemGroup>
12
-  <ItemGroup>
13
-    <ClCompile Include="pch.cpp" />
14
-    <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
15
-    <ClCompile Include="ReactPackageProvider.cpp" />
16
-    <ClCompile Include="WebViewManager.cpp" />
17
-  </ItemGroup>
18
-  <ItemGroup>
19
-    <ClInclude Include="pch.h" />
20
-    <ClInclude Include="ReactPackageProvider.h" />
21
-    <ClInclude Include="WebViewManager.h" />
22
-  </ItemGroup>
23
-  <ItemGroup>
24
-    <None Include="ReactNativeWebView.def" />
25
-    <None Include="packages.config" />
26
-  </ItemGroup>
27
-  <ItemGroup>
28
-    <None Include="PropertySheet.props" />
29
-  </ItemGroup>
30
-  <ItemGroup>
31
-    <Midl Include="ReactPackageProvider.idl" />
32
-  </ItemGroup>
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <ItemGroup>
4
+    <Filter Include="Resources">
5
+      <UniqueIdentifier>accd3aa8-1ba0-4223-9bbe-0c431709210b</UniqueIdentifier>
6
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
7
+    </Filter>
8
+    <Filter Include="Generated Files">
9
+      <UniqueIdentifier>{926ab91d-31b4-48c3-b9a4-e681349f27f0}</UniqueIdentifier>
10
+    </Filter>
11
+  </ItemGroup>
12
+  <ItemGroup>
13
+    <ClCompile Include="pch.cpp" />
14
+    <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
15
+    <ClCompile Include="ReactPackageProvider.cpp" />
16
+    <ClCompile Include="WebViewManager.cpp" />
17
+  </ItemGroup>
18
+  <ItemGroup>
19
+    <ClInclude Include="pch.h" />
20
+    <ClInclude Include="ReactPackageProvider.h" />
21
+    <ClInclude Include="WebViewManager.h" />
22
+  </ItemGroup>
23
+  <ItemGroup>
24
+    <None Include="ReactNativeWebView.def" />
25
+    <None Include="packages.config" />
26
+  </ItemGroup>
27
+  <ItemGroup>
28
+    <None Include="PropertySheet.props" />
29
+  </ItemGroup>
30
+  <ItemGroup>
31
+    <Midl Include="ReactPackageProvider.idl" />
32
+  </ItemGroup>
33 33
 </Project>

+ 159
- 161
windows/ReactNativeWebView/ReactNativeWebView.vcxproj Zobrazit soubor

@@ -1,162 +1,160 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
-  <Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" />
4
-  <PropertyGroup Label="Globals">
5
-    <CppWinRTOptimized>true</CppWinRTOptimized>
6
-    <CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
7
-    <MinimalCoreWin>true</MinimalCoreWin>
8
-    <ProjectGuid>{729d9af8-cd9e-4427-9f6c-fb757e287729}</ProjectGuid>
9
-    <ProjectName>ReactNativeWebView</ProjectName>
10
-    <RootNamespace>ReactNativeWebView</RootNamespace>
11
-    <DefaultLanguage>en-US</DefaultLanguage>
12
-    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
13
-    <AppContainerApplication>true</AppContainerApplication>
14
-    <ApplicationType>Windows Store</ApplicationType>
15
-    <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
16
-    <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
17
-    <WindowsTargetPlatformMinVersion>10.0.15063.0</WindowsTargetPlatformMinVersion>
18
-  </PropertyGroup>
19
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
20
-  <ItemGroup Label="ProjectConfigurations">
21
-    <ProjectConfiguration Include="Debug|ARM">
22
-      <Configuration>Debug</Configuration>
23
-      <Platform>ARM</Platform>
24
-    </ProjectConfiguration>
25
-    <ProjectConfiguration Include="Debug|Win32">
26
-      <Configuration>Debug</Configuration>
27
-      <Platform>Win32</Platform>
28
-    </ProjectConfiguration>
29
-    <ProjectConfiguration Include="Debug|x64">
30
-      <Configuration>Debug</Configuration>
31
-      <Platform>x64</Platform>
32
-    </ProjectConfiguration>
33
-    <ProjectConfiguration Include="Release|ARM">
34
-      <Configuration>Release</Configuration>
35
-      <Platform>ARM</Platform>
36
-    </ProjectConfiguration>
37
-    <ProjectConfiguration Include="Release|Win32">
38
-      <Configuration>Release</Configuration>
39
-      <Platform>Win32</Platform>
40
-    </ProjectConfiguration>
41
-    <ProjectConfiguration Include="Release|x64">
42
-      <Configuration>Release</Configuration>
43
-      <Platform>x64</Platform>
44
-    </ProjectConfiguration>
45
-  </ItemGroup>
46
-  <PropertyGroup Label="Configuration">
47
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
48
-    <PlatformToolset>v140</PlatformToolset>
49
-    <PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
50
-    <PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
51
-    <CharacterSet>Unicode</CharacterSet>
52
-    <GenerateManifest>false</GenerateManifest>
53
-  </PropertyGroup>
54
-  <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
55
-    <UseDebugLibraries>true</UseDebugLibraries>
56
-    <LinkIncremental>true</LinkIncremental>
57
-  </PropertyGroup>
58
-  <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
59
-    <UseDebugLibraries>false</UseDebugLibraries>
60
-    <WholeProgramOptimization>true</WholeProgramOptimization>
61
-    <LinkIncremental>false</LinkIncremental>
62
-  </PropertyGroup>
63
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
64
-  <ImportGroup Label="ExtensionSettings">
65
-  </ImportGroup>
66
-  <ImportGroup Label="Shared">
67
-    <Import Project="..\..\..\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems" Label="Shared" Condition="Exists('..\..\..\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems')" />
68
-    <Import Project="..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems" Label="Shared" Condition="Exists('..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems')"/>
69
-  </ImportGroup>
70
-  <ImportGroup Label="PropertySheets">
71
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
72
-  </ImportGroup>
73
-  <ImportGroup Label="PropertySheets">
74
-    <Import Project="PropertySheet.props" />
75
-  </ImportGroup>
76
-  <PropertyGroup Label="UserMacros" />
77
-  <PropertyGroup />
78
-  <ItemDefinitionGroup>
79
-    <ClCompile>
80
-      <PrecompiledHeader>Use</PrecompiledHeader>
81
-      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
82
-      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
83
-      <WarningLevel>Level4</WarningLevel>
84
-      <AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
85
-      <!--Temporarily disable cppwinrt heap enforcement to work around xaml compiler generated std::shared_ptr use -->
86
-      <AdditionalOptions Condition="'$(CppWinRTHeapEnforcement)'==''">/DWINRT_NO_MAKE_DETECTION %(AdditionalOptions)</AdditionalOptions>
87
-      <DisableSpecificWarnings>28204</DisableSpecificWarnings>
88
-      <PreprocessorDefinitions>_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
89
-      <AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
90
-    </ClCompile>
91
-    <Link>
92
-      <SubSystem>Console</SubSystem>
93
-      <GenerateWindowsMetadata>true</GenerateWindowsMetadata>
94
-      <ModuleDefinitionFile>ReactNativeWebView.def</ModuleDefinitionFile>
95
-    </Link>
96
-  </ItemDefinitionGroup>
97
-  <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
98
-    <ClCompile>
99
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
100
-    </ClCompile>
101
-  </ItemDefinitionGroup>
102
-  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
103
-    <ClCompile>
104
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
105
-    </ClCompile>
106
-  </ItemDefinitionGroup>
107
-  <ItemGroup>
108
-    <ClInclude Include="ReactWebView.h">
109
-      <DependentUpon>ReactWebView.idl</DependentUpon>
110
-    </ClInclude>
111
-    <ClInclude Include="ReactWebViewManager.h" />
112
-    <ClInclude Include="pch.h" />
113
-    <ClInclude Include="ReactPackageProvider.h">
114
-      <DependentUpon>ReactPackageProvider.idl</DependentUpon>
115
-    </ClInclude>
116
-  </ItemGroup>
117
-  <ItemGroup>
118
-    <ClCompile Include="ReactWebView.cpp">
119
-      <DependentUpon>ReactWebView.idl</DependentUpon>
120
-    </ClCompile>
121
-    <ClCompile Include="ReactWebViewManager.cpp" />
122
-    <ClCompile Include="pch.cpp">
123
-      <PrecompiledHeader>Create</PrecompiledHeader>
124
-    </ClCompile>
125
-    <ClCompile Include="ReactPackageProvider.cpp">
126
-      <DependentUpon>ReactPackageProvider.idl</DependentUpon>
127
-    </ClCompile>
128
-    <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
129
-  </ItemGroup>
130
-  <ItemGroup>
131
-    <Midl Include="ReactWebView.idl" />
132
-    <Midl Include="ReactPackageProvider.idl" />
133
-  </ItemGroup>
134
-  <ItemGroup>
135
-    <None Include="packages.config" />
136
-    <None Include="ReactNativeWebView.def" />
137
-  </ItemGroup>
138
-  <ItemGroup>
139
-    <None Include="PropertySheet.props" />
140
-  </ItemGroup>
141
-  <ItemGroup>
142
-    <ProjectReference Include="..\..\..\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj" Condition="Exists('..\..\..\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj')">
143
-      <Project>{f7d32bd0-2749-483e-9a0d-1635ef7e3136}</Project>
144
-      <Private>false</Private>
145
-    </ProjectReference>
146
-    <ProjectReference Include="..\..\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj" Condition="Exists('..\..\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj')">
147
-      <Project>{f7d32bd0-2749-483e-9a0d-1635ef7e3136}</Project>
148
-      <Private>false</Private>
149
-    </ProjectReference>
150
-  </ItemGroup>
151
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
152
-  <ImportGroup Label="ExtensionTargets">
153
-    <Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
154
-  </ImportGroup>
155
-  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
156
-    <PropertyGroup>
157
-      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
158
-    </PropertyGroup>
159
-    <Error Condition="!Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
160
-    <Error Condition="!Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
161
-  </Target>
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" />
4
+  <PropertyGroup Label="Globals">
5
+    <CppWinRTOptimized>true</CppWinRTOptimized>
6
+    <CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
7
+    <MinimalCoreWin>true</MinimalCoreWin>
8
+    <ProjectGuid>{729d9af8-cd9e-4427-9f6c-fb757e287729}</ProjectGuid>
9
+    <ProjectName>ReactNativeWebView</ProjectName>
10
+    <RootNamespace>ReactNativeWebView</RootNamespace>
11
+    <DefaultLanguage>en-US</DefaultLanguage>
12
+    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
13
+    <AppContainerApplication>true</AppContainerApplication>
14
+    <ApplicationType>Windows Store</ApplicationType>
15
+    <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
16
+    <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
17
+    <WindowsTargetPlatformMinVersion>10.0.15063.0</WindowsTargetPlatformMinVersion>
18
+  </PropertyGroup>
19
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
20
+  <ItemGroup Label="ProjectConfigurations">
21
+    <ProjectConfiguration Include="Debug|ARM">
22
+      <Configuration>Debug</Configuration>
23
+      <Platform>ARM</Platform>
24
+    </ProjectConfiguration>
25
+    <ProjectConfiguration Include="Debug|Win32">
26
+      <Configuration>Debug</Configuration>
27
+      <Platform>Win32</Platform>
28
+    </ProjectConfiguration>
29
+    <ProjectConfiguration Include="Debug|x64">
30
+      <Configuration>Debug</Configuration>
31
+      <Platform>x64</Platform>
32
+    </ProjectConfiguration>
33
+    <ProjectConfiguration Include="Release|ARM">
34
+      <Configuration>Release</Configuration>
35
+      <Platform>ARM</Platform>
36
+    </ProjectConfiguration>
37
+    <ProjectConfiguration Include="Release|Win32">
38
+      <Configuration>Release</Configuration>
39
+      <Platform>Win32</Platform>
40
+    </ProjectConfiguration>
41
+    <ProjectConfiguration Include="Release|x64">
42
+      <Configuration>Release</Configuration>
43
+      <Platform>x64</Platform>
44
+    </ProjectConfiguration>
45
+  </ItemGroup>
46
+  <PropertyGroup Label="Configuration">
47
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
48
+    <PlatformToolset>v140</PlatformToolset>
49
+    <PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
50
+    <PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
51
+    <CharacterSet>Unicode</CharacterSet>
52
+    <GenerateManifest>false</GenerateManifest>
53
+  </PropertyGroup>
54
+  <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
55
+    <UseDebugLibraries>true</UseDebugLibraries>
56
+    <LinkIncremental>true</LinkIncremental>
57
+  </PropertyGroup>
58
+  <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
59
+    <UseDebugLibraries>false</UseDebugLibraries>
60
+    <WholeProgramOptimization>true</WholeProgramOptimization>
61
+    <LinkIncremental>false</LinkIncremental>
62
+  </PropertyGroup>
63
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
64
+  <ImportGroup Label="ExtensionSettings">
65
+  </ImportGroup>
66
+  <PropertyGroup>
67
+    <ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
68
+  </PropertyGroup>
69
+  <ImportGroup Label="Shared">
70
+    <Import Project="$(ReactNativeWindowsDir)\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems" Label="Shared" />
71
+  </ImportGroup>
72
+  <ImportGroup Label="PropertySheets">
73
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
74
+  </ImportGroup>
75
+  <ImportGroup Label="PropertySheets">
76
+    <Import Project="PropertySheet.props" />
77
+  </ImportGroup>
78
+  <PropertyGroup Label="UserMacros" />
79
+  <PropertyGroup />
80
+  <ItemDefinitionGroup>
81
+    <ClCompile>
82
+      <PrecompiledHeader>Use</PrecompiledHeader>
83
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
84
+      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
85
+      <WarningLevel>Level4</WarningLevel>
86
+      <AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
87
+      <!--Temporarily disable cppwinrt heap enforcement to work around xaml compiler generated std::shared_ptr use -->
88
+      <AdditionalOptions Condition="'$(CppWinRTHeapEnforcement)'==''">/DWINRT_NO_MAKE_DETECTION %(AdditionalOptions)</AdditionalOptions>
89
+      <DisableSpecificWarnings>28204</DisableSpecificWarnings>
90
+      <PreprocessorDefinitions>_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
91
+      <AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
92
+    </ClCompile>
93
+    <Link>
94
+      <SubSystem>Console</SubSystem>
95
+      <GenerateWindowsMetadata>true</GenerateWindowsMetadata>
96
+      <ModuleDefinitionFile>ReactNativeWebView.def</ModuleDefinitionFile>
97
+    </Link>
98
+  </ItemDefinitionGroup>
99
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
100
+    <ClCompile>
101
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
102
+    </ClCompile>
103
+  </ItemDefinitionGroup>
104
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
105
+    <ClCompile>
106
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
107
+    </ClCompile>
108
+  </ItemDefinitionGroup>
109
+  <ItemGroup>
110
+    <ClInclude Include="ReactWebView.h">
111
+      <DependentUpon>ReactWebView.idl</DependentUpon>
112
+    </ClInclude>
113
+    <ClInclude Include="ReactWebViewManager.h" />
114
+    <ClInclude Include="pch.h" />
115
+    <ClInclude Include="ReactPackageProvider.h">
116
+      <DependentUpon>ReactPackageProvider.idl</DependentUpon>
117
+    </ClInclude>
118
+  </ItemGroup>
119
+  <ItemGroup>
120
+    <ClCompile Include="ReactWebView.cpp">
121
+      <DependentUpon>ReactWebView.idl</DependentUpon>
122
+    </ClCompile>
123
+    <ClCompile Include="ReactWebViewManager.cpp" />
124
+    <ClCompile Include="pch.cpp">
125
+      <PrecompiledHeader>Create</PrecompiledHeader>
126
+    </ClCompile>
127
+    <ClCompile Include="ReactPackageProvider.cpp">
128
+      <DependentUpon>ReactPackageProvider.idl</DependentUpon>
129
+    </ClCompile>
130
+    <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
131
+  </ItemGroup>
132
+  <ItemGroup>
133
+    <Midl Include="ReactWebView.idl" />
134
+    <Midl Include="ReactPackageProvider.idl" />
135
+  </ItemGroup>
136
+  <ItemGroup>
137
+    <None Include="packages.config" />
138
+    <None Include="ReactNativeWebView.def" />
139
+  </ItemGroup>
140
+  <ItemGroup>
141
+    <None Include="PropertySheet.props" />
142
+  </ItemGroup>
143
+  <ItemGroup>
144
+    <ProjectReference Include="$(ReactNativeWindowsDir)\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj">
145
+      <Project>{f7d32bd0-2749-483e-9a0d-1635ef7e3136}</Project>
146
+      <Private>false</Private>
147
+    </ProjectReference>
148
+  </ItemGroup>
149
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
150
+  <ImportGroup Label="ExtensionTargets">
151
+    <Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
152
+  </ImportGroup>
153
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
154
+    <PropertyGroup>
155
+      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
156
+    </PropertyGroup>
157
+    <Error Condition="!Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
158
+    <Error Condition="!Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
159
+  </Target>
162 160
 </Project>

+ 17
- 17
windows/ReactNativeWebView/ReactPackageProvider.cpp Zobrazit soubor

@@ -1,17 +1,17 @@
1
-#include "pch.h"
2
-#include "ReactPackageProvider.h"
3
-#if __has_include("ReactPackageProvider.g.cpp")
4
-#include "ReactPackageProvider.g.cpp"
5
-#endif
6
-
7
-#include "ReactWebViewManager.h"
8
-
9
-using namespace winrt::Microsoft::ReactNative;
10
-
11
-namespace winrt::ReactNativeWebView::implementation {
12
-
13
-void ReactPackageProvider::CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept {
14
-  packageBuilder.AddViewManager(L"ReactWebViewManager", []() { return winrt::make<ReactWebViewManager>(); });
15
-}
16
-
17
-} // namespace winrt::ReactNativeWebView::implementation
1
+#include "pch.h"
2
+#include "ReactPackageProvider.h"
3
+#if __has_include("ReactPackageProvider.g.cpp")
4
+#include "ReactPackageProvider.g.cpp"
5
+#endif
6
+
7
+#include "ReactWebViewManager.h"
8
+
9
+using namespace winrt::Microsoft::ReactNative;
10
+
11
+namespace winrt::ReactNativeWebView::implementation {
12
+
13
+void ReactPackageProvider::CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept {
14
+  packageBuilder.AddViewManager(L"ReactWebViewManager", []() { return winrt::make<ReactWebViewManager>(); });
15
+}
16
+
17
+} // namespace winrt::ReactNativeWebView::implementation

+ 20
- 20
windows/ReactNativeWebView/ReactPackageProvider.h Zobrazit soubor

@@ -1,20 +1,20 @@
1
-#pragma once
2
-#include "ReactPackageProvider.g.h"
3
-
4
-using namespace winrt::Microsoft::ReactNative;
5
-
6
-namespace winrt::ReactNativeWebView::implementation {
7
-
8
-struct ReactPackageProvider : ReactPackageProviderT<ReactPackageProvider> {
9
-  ReactPackageProvider() = default;
10
-
11
-  void CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept;
12
-};
13
-
14
-} // namespace winrt::ReactNativeWebView::implementation
15
-
16
-namespace winrt::ReactNativeWebView::factory_implementation {
17
-
18
-struct ReactPackageProvider : ReactPackageProviderT<ReactPackageProvider, implementation::ReactPackageProvider> {};
19
-
20
-} // namespace winrt::ReactNativeWebView::factory_implementation
1
+#pragma once
2
+#include "ReactPackageProvider.g.h"
3
+
4
+using namespace winrt::Microsoft::ReactNative;
5
+
6
+namespace winrt::ReactNativeWebView::implementation {
7
+
8
+struct ReactPackageProvider : ReactPackageProviderT<ReactPackageProvider> {
9
+  ReactPackageProvider() = default;
10
+
11
+  void CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept;
12
+};
13
+
14
+} // namespace winrt::ReactNativeWebView::implementation
15
+
16
+namespace winrt::ReactNativeWebView::factory_implementation {
17
+
18
+struct ReactPackageProvider : ReactPackageProviderT<ReactPackageProvider, implementation::ReactPackageProvider> {};
19
+
20
+} // namespace winrt::ReactNativeWebView::factory_implementation

+ 7
- 7
windows/ReactNativeWebView/ReactPackageProvider.idl Zobrazit soubor

@@ -1,7 +1,7 @@
1
-namespace ReactNativeWebView {
2
-[webhosthidden]
3
-[default_interface] 
4
-runtimeclass ReactPackageProvider : Microsoft.ReactNative.IReactPackageProvider {
5
-  ReactPackageProvider();
6
-};
7
-} // namespace ReactNativeWebView
1
+namespace ReactNativeWebView {
2
+[webhosthidden]
3
+[default_interface] 
4
+runtimeclass ReactPackageProvider : Microsoft.ReactNative.IReactPackageProvider {
5
+  ReactPackageProvider();
6
+};
7
+} // namespace ReactNativeWebView

+ 147
- 143
windows/ReactNativeWebView/ReactWebView.cpp Zobrazit soubor

@@ -1,144 +1,148 @@
1
-// Copyright (c) Microsoft Corporation. All rights reserved.
2
-// Licensed under the MIT License.
3
-
4
-#include "pch.h"
5
-#include "JSValueXaml.h"
6
-#include "ReactWebView.h"
7
-#include "ReactWebView.g.cpp"
8
-
9
-namespace winrt {
10
-    using namespace Microsoft::ReactNative;
11
-    using namespace Windows::Data::Json;
12
-    using namespace Windows::Foundation;
13
-    using namespace Windows::UI;
14
-    using namespace Windows::UI::Popups;
15
-    using namespace Windows::UI::Xaml;
16
-    using namespace Windows::UI::Xaml::Controls;
17
-    using namespace Windows::UI::Xaml::Input;
18
-    using namespace Windows::UI::Xaml::Media;
19
-} // namespace winrt
20
-
21
-namespace winrt::ReactNativeWebView::implementation {
22
-
23
-    ReactWebView::ReactWebView(winrt::IReactContext const& reactContext) : m_reactContext(reactContext) {
24
-#ifdef CHAKRACORE_UWP
25
-        m_webView = winrt::WebView(winrt::WebViewExecutionMode::SeparateProcess);
26
-#else
27
-        m_webView = winrt::WebView();
28
-#endif
29
-        RegisterEvents();
30
-    }
31
-
32
-    winrt::WebView ReactWebView::GetView() {
33
-        return m_webView;
34
-    }
35
-
36
-    void ReactWebView::RegisterEvents() {
37
-        m_navigationStartingRevoker = m_webView.NavigationStarting(
38
-            winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
39
-                if (auto self = ref.get()) {
40
-                    self->OnNavigationStarting(sender, args);
41
-                }
42
-                
43
-            });
44
-
45
-        m_navigationCompletedRevoker = m_webView.NavigationCompleted(
46
-            winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
47
-                if (auto self = ref.get()) {
48
-                    self->OnNavigationCompleted(sender, args);
49
-                }
50
-            });
51
-
52
-        m_navigationFailedRevoker = m_webView.NavigationFailed(
53
-            winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
54
-                if (auto self = ref.get()) {
55
-                    self->OnNavigationFailed(sender, args);
56
-                }
57
-            });
58
-
59
-        m_scriptNotifyRevoker = m_webView.ScriptNotify(
60
-            winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
61
-                if (auto self = ref.get()) {
62
-                    self->OnScriptNotify(sender, args);
63
-                }
64
-            });
65
-    }
66
-
67
-    void ReactWebView::WriteWebViewNavigationEventArg(winrt::IJSValueWriter const& eventDataWriter) {
68
-        auto tag = m_webView.GetValue(winrt::FrameworkElement::TagProperty()).as<winrt::IPropertyValue>().GetInt64();
69
-        WriteProperty(eventDataWriter, L"canGoBack", m_webView.CanGoBack());
70
-        WriteProperty(eventDataWriter, L"canGoForward", m_webView.CanGoForward());
71
-        WriteProperty(eventDataWriter, L"loading", !m_webView.IsLoaded());
72
-        WriteProperty(eventDataWriter, L"target", tag);
73
-        WriteProperty(eventDataWriter, L"title", m_webView.DocumentTitle());
74
-        if (auto uri = m_webView.Source()) {
75
-            WriteProperty(eventDataWriter, L"url", uri.AbsoluteCanonicalUri());
76
-        }
77
-    }
78
-
79
-    void ReactWebView::OnNavigationStarting(winrt::WebView const& webView, winrt::WebViewNavigationStartingEventArgs const& /*args*/) {
80
-        m_reactContext.DispatchEvent(
81
-            webView,
82
-            L"topLoadingStart",
83
-            [&](winrt::IJSValueWriter const& eventDataWriter) noexcept {
84
-                eventDataWriter.WriteObjectBegin();
85
-                WriteWebViewNavigationEventArg(eventDataWriter);
86
-                eventDataWriter.WriteObjectEnd();
87
-            });
88
-    }
89
-
90
-    void ReactWebView::OnNavigationCompleted(winrt::WebView const& webView, winrt::WebViewNavigationCompletedEventArgs const& /*args*/) {
91
-        m_reactContext.DispatchEvent(
92
-            webView,
93
-            L"topLoadingFinish",
94
-            [&](winrt::IJSValueWriter const& eventDataWriter) noexcept {
95
-                eventDataWriter.WriteObjectBegin();
96
-                WriteWebViewNavigationEventArg(eventDataWriter);
97
-                eventDataWriter.WriteObjectEnd();
98
-            });
99
-
100
-        winrt::hstring windowAlert = L"window.alert = function (msg) {window.external.notify(`{\"type\":\"alert\",\"message\":\"${msg}\"}`)};";
101
-        winrt::hstring postMessage = L"window.ReactNativeWebView = {postMessage: function (data) {window.external.notify(String(data))}};";
102
-        m_webView.InvokeScriptAsync(L"eval", { windowAlert + postMessage });
103
-    }
104
-
105
-    void ReactWebView::OnNavigationFailed(winrt::IInspectable const& /*sender*/, winrt::WebViewNavigationFailedEventArgs const& args) {
106
-        m_reactContext.DispatchEvent(
107
-            m_webView,
108
-            L"topLoadingError",
109
-            [&](winrt::IJSValueWriter const& eventDataWriter) noexcept {
110
-                auto httpCode = static_cast<int32_t>(args.WebErrorStatus());
111
-                eventDataWriter.WriteObjectBegin();
112
-                {
113
-                    WriteProperty(eventDataWriter, L"code", httpCode);
114
-                    WriteWebViewNavigationEventArg(eventDataWriter);
115
-                }
116
-                eventDataWriter.WriteObjectEnd();
117
-            });
118
-    }
119
-
120
-    void ReactWebView::OnScriptNotify(winrt::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::Controls::NotifyEventArgs const& args) {
121
-        winrt::JsonObject jsonObject;
122
-        if (winrt::JsonObject::TryParse(args.Value(), jsonObject)) {
123
-            auto type = jsonObject.GetNamedString(L"type");
124
-            if (type == L"alert") {
125
-                auto dialog = winrt::MessageDialog(jsonObject.GetNamedString(L"message"));
126
-                dialog.Commands().Append(winrt::UICommand(L"OK"));
127
-                dialog.ShowAsync();
128
-            }
129
-        }
130
-        else {
131
-            m_reactContext.DispatchEvent(
132
-                m_webView,
133
-                L"topMessage",
134
-                [&](winrt::Microsoft::ReactNative::IJSValueWriter const& eventDataWriter) noexcept {
135
-                    eventDataWriter.WriteObjectBegin();
136
-                    {
137
-                        WriteProperty(eventDataWriter, L"data", winrt::to_string(args.Value()));
138
-                    }
139
-                    eventDataWriter.WriteObjectEnd();
140
-                });
141
-        }
142
-    }
143
-
1
+// Copyright (c) Microsoft Corporation. All rights reserved.
2
+// Licensed under the MIT License.
3
+
4
+#include "pch.h"
5
+#include "JSValueXaml.h"
6
+#include "ReactWebView.h"
7
+#include "ReactWebView.g.cpp"
8
+
9
+namespace winrt {
10
+    using namespace Microsoft::ReactNative;
11
+    using namespace Windows::Data::Json;
12
+    using namespace Windows::Foundation;
13
+    using namespace Windows::UI;
14
+    using namespace Windows::UI::Popups;
15
+    using namespace Windows::UI::Xaml;
16
+    using namespace Windows::UI::Xaml::Controls;
17
+    using namespace Windows::UI::Xaml::Input;
18
+    using namespace Windows::UI::Xaml::Media;
19
+} // namespace winrt
20
+
21
+namespace winrt::ReactNativeWebView::implementation {
22
+
23
+    ReactWebView::ReactWebView(winrt::IReactContext const& reactContext) : m_reactContext(reactContext) {
24
+#ifdef CHAKRACORE_UWP
25
+        m_webView = winrt::WebView(winrt::WebViewExecutionMode::SeparateProcess);
26
+#else
27
+        m_webView = winrt::WebView();
28
+#endif
29
+        RegisterEvents();
30
+    }
31
+
32
+    winrt::WebView ReactWebView::GetView() {
33
+        return m_webView;
34
+    }
35
+
36
+    void ReactWebView::RegisterEvents() {
37
+        m_navigationStartingRevoker = m_webView.NavigationStarting(
38
+            winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
39
+                if (auto self = ref.get()) {
40
+                    self->OnNavigationStarting(sender, args);
41
+                }
42
+                
43
+            });
44
+
45
+        m_navigationCompletedRevoker = m_webView.NavigationCompleted(
46
+            winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
47
+                if (auto self = ref.get()) {
48
+                    self->OnNavigationCompleted(sender, args);
49
+                }
50
+            });
51
+
52
+        m_navigationFailedRevoker = m_webView.NavigationFailed(
53
+            winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
54
+                if (auto self = ref.get()) {
55
+                    self->OnNavigationFailed(sender, args);
56
+                }
57
+            });
58
+
59
+        m_scriptNotifyRevoker = m_webView.ScriptNotify(
60
+            winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
61
+                if (auto self = ref.get()) {
62
+                    self->OnScriptNotify(sender, args);
63
+                }
64
+            });
65
+    }
66
+
67
+    void ReactWebView::WriteWebViewNavigationEventArg(winrt::IJSValueWriter const& eventDataWriter) {
68
+        auto tag = m_webView.GetValue(winrt::FrameworkElement::TagProperty()).as<winrt::IPropertyValue>().GetInt64();
69
+        WriteProperty(eventDataWriter, L"canGoBack", m_webView.CanGoBack());
70
+        WriteProperty(eventDataWriter, L"canGoForward", m_webView.CanGoForward());
71
+        WriteProperty(eventDataWriter, L"loading", !m_webView.IsLoaded());
72
+        WriteProperty(eventDataWriter, L"target", tag);
73
+        WriteProperty(eventDataWriter, L"title", m_webView.DocumentTitle());
74
+        if (auto uri = m_webView.Source()) {
75
+            WriteProperty(eventDataWriter, L"url", uri.AbsoluteCanonicalUri());
76
+        }
77
+    }
78
+
79
+    void ReactWebView::OnNavigationStarting(winrt::WebView const& webView, winrt::WebViewNavigationStartingEventArgs const& /*args*/) {
80
+        m_reactContext.DispatchEvent(
81
+            webView,
82
+            L"topLoadingStart",
83
+            [&](winrt::IJSValueWriter const& eventDataWriter) noexcept {
84
+                eventDataWriter.WriteObjectBegin();
85
+                WriteWebViewNavigationEventArg(eventDataWriter);
86
+                eventDataWriter.WriteObjectEnd();
87
+            });
88
+    }
89
+
90
+    void ReactWebView::OnNavigationCompleted(winrt::WebView const& webView, winrt::WebViewNavigationCompletedEventArgs const& /*args*/) {
91
+        m_reactContext.DispatchEvent(
92
+            webView,
93
+            L"topLoadingFinish",
94
+            [&](winrt::IJSValueWriter const& eventDataWriter) noexcept {
95
+                eventDataWriter.WriteObjectBegin();
96
+                WriteWebViewNavigationEventArg(eventDataWriter);
97
+                eventDataWriter.WriteObjectEnd();
98
+            });
99
+
100
+        winrt::hstring windowAlert = L"window.alert = function (msg) {window.external.notify(`{\"type\":\"__alert\",\"message\":\"${msg}\"}`)};";
101
+        winrt::hstring postMessage = L"window.ReactNativeWebView = {postMessage: function (data) {window.external.notify(String(data))}};";
102
+        m_webView.InvokeScriptAsync(L"eval", { windowAlert + postMessage });
103
+    }
104
+
105
+    void ReactWebView::OnNavigationFailed(winrt::IInspectable const& /*sender*/, winrt::WebViewNavigationFailedEventArgs const& args) {
106
+        m_reactContext.DispatchEvent(
107
+            m_webView,
108
+            L"topLoadingError",
109
+            [&](winrt::IJSValueWriter const& eventDataWriter) noexcept {
110
+                auto httpCode = static_cast<int32_t>(args.WebErrorStatus());
111
+                eventDataWriter.WriteObjectBegin();
112
+                {
113
+                    WriteProperty(eventDataWriter, L"code", httpCode);
114
+                    WriteWebViewNavigationEventArg(eventDataWriter);
115
+                }
116
+                eventDataWriter.WriteObjectEnd();
117
+            });
118
+    }
119
+
120
+    void ReactWebView::OnScriptNotify(winrt::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::Controls::NotifyEventArgs const& args) {
121
+        winrt::JsonObject jsonObject;
122
+        if (winrt::JsonObject::TryParse(args.Value(), jsonObject) && jsonObject.HasKey(L"type")) {
123
+            auto type = jsonObject.GetNamedString(L"type");
124
+            if (type == L"__alert") {
125
+                auto dialog = winrt::MessageDialog(jsonObject.GetNamedString(L"message"));
126
+                dialog.Commands().Append(winrt::UICommand(L"OK"));
127
+                dialog.ShowAsync();
128
+                return;
129
+            }
130
+        }
131
+        
132
+        PostMessage(winrt::hstring(args.Value()));
133
+    }
134
+
135
+    void ReactWebView::PostMessage(winrt::hstring const& message) {
136
+        m_reactContext.DispatchEvent(
137
+            m_webView,
138
+            L"topMessage",
139
+            [&](winrt::Microsoft::ReactNative::IJSValueWriter const& eventDataWriter) noexcept {
140
+                eventDataWriter.WriteObjectBegin();
141
+                {
142
+                    WriteProperty(eventDataWriter, L"data", message);
143
+                }
144
+                eventDataWriter.WriteObjectEnd();
145
+            });
146
+    }
147
+
144 148
 } // namespace winrt::ReactNativeWebView::implementation

+ 36
- 35
windows/ReactNativeWebView/ReactWebView.h Zobrazit soubor

@@ -1,36 +1,37 @@
1
-// Copyright (c) Microsoft Corporation. All rights reserved.
2
-// Licensed under the MIT License.
3
-
4
-#pragma once
5
-
6
-#include "winrt/Microsoft.ReactNative.h"
7
-#include "NativeModules.h"
8
-#include "ReactWebView.g.h"
9
-
10
-namespace winrt::ReactNativeWebView::implementation {
11
-
12
-    class ReactWebView : public ReactWebViewT<ReactWebView> {
13
-    public:
14
-        ReactWebView(Microsoft::ReactNative::IReactContext const& reactContext);
15
-        winrt::Windows::UI::Xaml::Controls::WebView GetView();
16
-
17
-    private:
18
-        winrt::Windows::UI::Xaml::Controls::WebView m_webView{ nullptr };
19
-        Microsoft::ReactNative::IReactContext m_reactContext{ nullptr };
20
-        winrt::Windows::UI::Xaml::Controls::WebView::NavigationStarting_revoker m_navigationStartingRevoker{};
21
-        winrt::Windows::UI::Xaml::Controls::WebView::NavigationCompleted_revoker m_navigationCompletedRevoker{};
22
-        winrt::Windows::UI::Xaml::Controls::WebView::NavigationFailed_revoker m_navigationFailedRevoker{};
23
-        winrt::Windows::UI::Xaml::Controls::WebView::ScriptNotify_revoker m_scriptNotifyRevoker{};
24
-
25
-        void RegisterEvents();
26
-        void WriteWebViewNavigationEventArg(winrt::Microsoft::ReactNative::IJSValueWriter const& eventDataWriter);
27
-        void OnNavigationStarting(winrt::Windows::UI::Xaml::Controls::WebView const& sender, winrt::Windows::UI::Xaml::Controls::WebViewNavigationStartingEventArgs const& args);
28
-        void OnNavigationCompleted(winrt::Windows::UI::Xaml::Controls::WebView const& sender, winrt::Windows::UI::Xaml::Controls::WebViewNavigationCompletedEventArgs const& args);
29
-        void OnNavigationFailed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::WebViewNavigationFailedEventArgs const& args);
30
-        void OnScriptNotify(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::NotifyEventArgs const& args);
31
-    };
32
-} // namespace winrt::ReactNativeWebView::implementation
33
-
34
-namespace winrt::ReactNativeWebView::factory_implementation {
35
-    struct ReactWebView : ReactWebViewT<ReactWebView, implementation::ReactWebView> {};
1
+// Copyright (c) Microsoft Corporation. All rights reserved.
2
+// Licensed under the MIT License.
3
+
4
+#pragma once
5
+
6
+#include "winrt/Microsoft.ReactNative.h"
7
+#include "NativeModules.h"
8
+#include "ReactWebView.g.h"
9
+
10
+namespace winrt::ReactNativeWebView::implementation {
11
+
12
+    class ReactWebView : public ReactWebViewT<ReactWebView> {
13
+    public:
14
+        ReactWebView(Microsoft::ReactNative::IReactContext const& reactContext);
15
+        winrt::Windows::UI::Xaml::Controls::WebView GetView();
16
+        void PostMessage(winrt::hstring const& message);
17
+
18
+    private:
19
+        winrt::Windows::UI::Xaml::Controls::WebView m_webView{ nullptr };
20
+        Microsoft::ReactNative::IReactContext m_reactContext{ nullptr };
21
+        winrt::Windows::UI::Xaml::Controls::WebView::NavigationStarting_revoker m_navigationStartingRevoker{};
22
+        winrt::Windows::UI::Xaml::Controls::WebView::NavigationCompleted_revoker m_navigationCompletedRevoker{};
23
+        winrt::Windows::UI::Xaml::Controls::WebView::NavigationFailed_revoker m_navigationFailedRevoker{};
24
+        winrt::Windows::UI::Xaml::Controls::WebView::ScriptNotify_revoker m_scriptNotifyRevoker{};
25
+
26
+        void RegisterEvents();
27
+        void WriteWebViewNavigationEventArg(winrt::Microsoft::ReactNative::IJSValueWriter const& eventDataWriter);
28
+        void OnNavigationStarting(winrt::Windows::UI::Xaml::Controls::WebView const& sender, winrt::Windows::UI::Xaml::Controls::WebViewNavigationStartingEventArgs const& args);
29
+        void OnNavigationCompleted(winrt::Windows::UI::Xaml::Controls::WebView const& sender, winrt::Windows::UI::Xaml::Controls::WebViewNavigationCompletedEventArgs const& args);
30
+        void OnNavigationFailed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::WebViewNavigationFailedEventArgs const& args);
31
+        void OnScriptNotify(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::NotifyEventArgs const& args);
32
+    };
33
+} // namespace winrt::ReactNativeWebView::implementation
34
+
35
+namespace winrt::ReactNativeWebView::factory_implementation {
36
+    struct ReactWebView : ReactWebViewT<ReactWebView, implementation::ReactWebView> {};
36 37
 } // namespace winrt::ReactNativeWebView::factory_implementation

+ 7
- 6
windows/ReactNativeWebView/ReactWebView.idl Zobrazit soubor

@@ -1,7 +1,8 @@
1
-namespace ReactNativeWebView{
2
-    [default_interface]
3
-    runtimeclass ReactWebView : Windows.UI.Xaml.Controls.UserControl{
4
-        ReactWebView(Microsoft.ReactNative.IReactContext context);
5
-        Windows.UI.Xaml.Controls.WebView GetView();
6
-    };
1
+namespace ReactNativeWebView{
2
+    [default_interface]
3
+    runtimeclass ReactWebView : Windows.UI.Xaml.Controls.UserControl{
4
+        ReactWebView(Microsoft.ReactNative.IReactContext context);
5
+        Windows.UI.Xaml.Controls.WebView GetView();
6
+        void PostMessage(String message);
7
+    };
7 8
 } // namespace ReactNativeWebView

+ 144
- 143
windows/ReactNativeWebView/ReactWebViewManager.cpp Zobrazit soubor

@@ -1,144 +1,145 @@
1
-#include "pch.h"
2
-#include "ReactWebViewManager.h"
3
-#include "NativeModules.h"
4
-#include "ReactWebView.h"
5
-#include "JSValueXaml.h"
6
-
7
-namespace winrt {
8
-    using namespace Microsoft::ReactNative;
9
-    using namespace Windows::Foundation;
10
-    using namespace Windows::Foundation::Collections;
11
-    using namespace Windows::UI;
12
-    using namespace Windows::UI::Xaml;
13
-    using namespace Windows::UI::Xaml::Controls;
14
-}
15
-
16
-namespace winrt::ReactNativeWebView::implementation {
17
-
18
-    ReactWebViewManager::ReactWebViewManager() {}
19
-
20
-    // IViewManager
21
-    winrt::hstring ReactWebViewManager::Name() noexcept {
22
-        return L"RCTWebView";
23
-    }
24
-
25
-    winrt::FrameworkElement ReactWebViewManager::CreateView() noexcept {
26
-        m_reactWebView = *winrt::make_self<ReactWebView>(m_reactContext);
27
-        return m_reactWebView.GetView();
28
-    }
29
-
30
-    // IViewManagerWithReactContext
31
-    winrt::IReactContext ReactWebViewManager::ReactContext() noexcept {
32
-        return m_reactContext;
33
-    }
34
-
35
-    void ReactWebViewManager::ReactContext(IReactContext reactContext) noexcept {
36
-        m_reactContext = reactContext;
37
-    }
38
-
39
-    // IViewManagerWithNativeProperties
40
-    IMapView<hstring, ViewManagerPropertyType> ReactWebViewManager::NativeProps() noexcept {
41
-        auto nativeProps = winrt::single_threaded_map<hstring, ViewManagerPropertyType>();
42
-        nativeProps.Insert(L"source", ViewManagerPropertyType::Map);
43
-        return nativeProps.GetView();
44
-    }
45
-
46
-    void ReactWebViewManager::UpdateProperties(
47
-        FrameworkElement const& view,
48
-        IJSValueReader const& propertyMapReader) noexcept {
49
-        if (auto webView = view.try_as<winrt::WebView>()) {
50
-            const JSValueObject& propertyMap = JSValueObject::ReadFrom(propertyMapReader);
51
-
52
-            for (auto const& pair : propertyMap) {
53
-                auto const& propertyName = pair.first;
54
-                auto const& propertyValue = pair.second;
55
-                if (propertyValue.IsNull()) continue;
56
-
57
-                if (propertyName == "source") {
58
-                    auto const& srcMap = propertyValue.AsObject();
59
-                    if (srcMap.find("uri") != srcMap.end()) {
60
-                        auto uriString = srcMap.at("uri").AsString();
61
-                        // non-uri sources not yet supported
62
-                        if (uriString.length() == 0) {
63
-                            continue;
64
-                        }
65
-
66
-                        bool isPackagerAsset = false;
67
-                        if (srcMap.find("__packager_asset") != srcMap.end()) {
68
-                            isPackagerAsset = srcMap.at("__packager_asset").AsBoolean();
69
-                        }
70
-
71
-                        if (isPackagerAsset && uriString.find("assets") == 0) {
72
-                            uriString.replace(0, 6, "ms-appx://");
73
-                        }
74
-
75
-                        webView.Navigate(winrt::Uri(to_hstring(uriString)));
76
-                    }
77
-                    else if (srcMap.find("html") != srcMap.end()) {
78
-                        auto htmlString = srcMap.at("html").AsString();
79
-                        webView.NavigateToString(to_hstring(htmlString));
80
-                    }
81
-                }
82
-                else if (propertyName == "backgroundColor") {
83
-                    auto color = propertyValue.To<winrt::Color>();
84
-                    webView.DefaultBackgroundColor(color.A==0 ? winrt::Colors::Transparent() : color);
85
-                }
86
-            }
87
-        }
88
-    }
89
-
90
-    // IViewManagerWithExportedEventTypeConstants
91
-    ConstantProviderDelegate ReactWebViewManager::ExportedCustomBubblingEventTypeConstants() noexcept {
92
-        return nullptr;
93
-    }
94
-
95
-    ConstantProviderDelegate ReactWebViewManager::ExportedCustomDirectEventTypeConstants() noexcept {
96
-        return [](winrt::IJSValueWriter const& constantWriter) {
97
-            WriteCustomDirectEventTypeConstant(constantWriter, "onLoadingStart");
98
-            WriteCustomDirectEventTypeConstant(constantWriter, "onLoadingFinish");
99
-            WriteCustomDirectEventTypeConstant(constantWriter, "onLoadingError");
100
-            WriteCustomDirectEventTypeConstant(constantWriter, "onMessage");
101
-        };
102
-    }
103
-
104
-    // IViewManagerWithCommands
105
-    IMapView<hstring, int64_t> ReactWebViewManager::Commands() noexcept {
106
-        auto commands = winrt::single_threaded_map<hstring, int64_t>();
107
-        commands.Insert(L"goForward", static_cast<int32_t>(WebViewCommands::GoForward));
108
-        commands.Insert(L"goBack", static_cast<int32_t>(WebViewCommands::GoBack));
109
-        commands.Insert(L"reload", static_cast<int32_t>(WebViewCommands::Reload));
110
-        commands.Insert(L"stopLoading", static_cast<int32_t>(WebViewCommands::StopLoading));
111
-        commands.Insert(L"injectJavaScript", static_cast<int32_t>(WebViewCommands::InjectJavaScript));
112
-        return commands.GetView();
113
-    }
114
-
115
-    void ReactWebViewManager::DispatchCommand(
116
-        FrameworkElement const& view,
117
-        int64_t commandId,
118
-        winrt::IJSValueReader const& commandArgsReader) noexcept {
119
-        if (auto webView = view.try_as<winrt::WebView>()) {
120
-            switch (commandId) {
121
-                case static_cast<int64_t>(WebViewCommands::GoForward) :
122
-                    if (webView.CanGoForward()) {
123
-                        webView.GoForward();
124
-                    }
125
-                    break;
126
-                case static_cast<int64_t>(WebViewCommands::GoBack) :
127
-                    if (webView.CanGoBack()) {
128
-                        webView.GoBack();
129
-                    }
130
-                    break;
131
-                case static_cast<int64_t>(WebViewCommands::Reload) :
132
-                    webView.Refresh();
133
-                    break;
134
-                case static_cast<int64_t>(WebViewCommands::StopLoading) :
135
-                    webView.Stop();
136
-                    break;
137
-                case static_cast<int64_t>(WebViewCommands::InjectJavaScript) :
138
-                    webView.InvokeScriptAsync(L"eval", { commandArgsReader.GetString() });
139
-                    break;
140
-            }
141
-        }
142
-    }
143
-
1
+#include "pch.h"
2
+#include "ReactWebViewManager.h"
3
+#include "NativeModules.h"
4
+#include "ReactWebView.h"
5
+#include "JSValueXaml.h"
6
+
7
+namespace winrt {
8
+    using namespace Microsoft::ReactNative;
9
+    using namespace Windows::Foundation;
10
+    using namespace Windows::Foundation::Collections;
11
+    using namespace Windows::UI;
12
+    using namespace Windows::UI::Xaml;
13
+    using namespace Windows::UI::Xaml::Controls;
14
+}
15
+
16
+namespace winrt::ReactNativeWebView::implementation {
17
+
18
+    ReactWebViewManager::ReactWebViewManager() {}
19
+
20
+    // IViewManager
21
+    winrt::hstring ReactWebViewManager::Name() noexcept {
22
+        return L"RCTWebView";
23
+    }
24
+
25
+    winrt::FrameworkElement ReactWebViewManager::CreateView() noexcept {
26
+        m_reactWebView = *winrt::make_self<ReactWebView>(m_reactContext);
27
+        return m_reactWebView.GetView();
28
+    }
29
+
30
+    // IViewManagerWithReactContext
31
+    winrt::IReactContext ReactWebViewManager::ReactContext() noexcept {
32
+        return m_reactContext;
33
+    }
34
+
35
+    void ReactWebViewManager::ReactContext(IReactContext reactContext) noexcept {
36
+        m_reactContext = reactContext;
37
+    }
38
+
39
+    // IViewManagerWithNativeProperties
40
+    IMapView<hstring, ViewManagerPropertyType> ReactWebViewManager::NativeProps() noexcept {
41
+        auto nativeProps = winrt::single_threaded_map<hstring, ViewManagerPropertyType>();
42
+        nativeProps.Insert(L"source", ViewManagerPropertyType::Map);
43
+        return nativeProps.GetView();
44
+    }
45
+
46
+    void ReactWebViewManager::UpdateProperties(
47
+        FrameworkElement const& view,
48
+        IJSValueReader const& propertyMapReader) noexcept {
49
+        if (auto webView = view.try_as<winrt::WebView>()) {
50
+            const JSValueObject& propertyMap = JSValueObject::ReadFrom(propertyMapReader);
51
+
52
+            for (auto const& pair : propertyMap) {
53
+                auto const& propertyName = pair.first;
54
+                auto const& propertyValue = pair.second;
55
+                if (propertyValue.IsNull()) continue;
56
+
57
+                if (propertyName == "source") {
58
+                    auto const& srcMap = propertyValue.AsObject();
59
+                    if (srcMap.find("uri") != srcMap.end()) {
60
+                        auto uriString = srcMap.at("uri").AsString();
61
+                        if (uriString.length() == 0) {
62
+                            continue;
63
+                        }
64
+
65
+                        bool isPackagerAsset = false;
66
+                        if (srcMap.find("__packager_asset") != srcMap.end()) {
67
+                            isPackagerAsset = srcMap.at("__packager_asset").AsBoolean();
68
+                        }
69
+                        if (isPackagerAsset && uriString.find("file://") == 0) {
70
+                            auto bundleRootPath = winrt::to_string(ReactNativeHost().InstanceSettings().BundleRootPath());
71
+                            uriString.replace(0, 7, bundleRootPath.empty() ? "ms-appx-web:///Bundle/" : bundleRootPath);
72
+                        }
73
+
74
+                        webView.Navigate(winrt::Uri(to_hstring(uriString)));
75
+                    }
76
+                    else if (srcMap.find("html") != srcMap.end()) {
77
+                        auto htmlString = srcMap.at("html").AsString();
78
+                        webView.NavigateToString(to_hstring(htmlString));
79
+                    }
80
+                }
81
+                else if (propertyName == "backgroundColor") {
82
+                    auto color = propertyValue.To<winrt::Color>();
83
+                    webView.DefaultBackgroundColor(color.A==0 ? winrt::Colors::Transparent() : color);
84
+                }
85
+            }
86
+        }
87
+    }
88
+
89
+    // IViewManagerWithExportedEventTypeConstants
90
+    ConstantProviderDelegate ReactWebViewManager::ExportedCustomBubblingEventTypeConstants() noexcept {
91
+        return nullptr;
92
+    }
93
+
94
+    ConstantProviderDelegate ReactWebViewManager::ExportedCustomDirectEventTypeConstants() noexcept {
95
+        return [](winrt::IJSValueWriter const& constantWriter) {
96
+            WriteCustomDirectEventTypeConstant(constantWriter, "LoadingStart");
97
+            WriteCustomDirectEventTypeConstant(constantWriter, "LoadingFinish");
98
+            WriteCustomDirectEventTypeConstant(constantWriter, "LoadingError");
99
+            WriteCustomDirectEventTypeConstant(constantWriter, "Message");
100
+        };
101
+    }
102
+
103
+    // IViewManagerWithCommands
104
+    IVectorView<hstring> ReactWebViewManager::Commands() noexcept {
105
+        auto commands = winrt::single_threaded_vector<hstring>();
106
+        commands.Append(L"goForward");
107
+        commands.Append(L"goBack");
108
+        commands.Append(L"reload");
109
+        commands.Append(L"stopLoading");
110
+        commands.Append(L"injectJavaScript");
111
+        commands.Append(L"postMessage");
112
+        return commands.GetView();
113
+    }
114
+
115
+    void ReactWebViewManager::DispatchCommand(
116
+        FrameworkElement const& view,
117
+        winrt::hstring const& commandId,
118
+        winrt::IJSValueReader const& commandArgsReader) noexcept {
119
+        auto commandArgs = JSValue::ReadArrayFrom(commandArgsReader);
120
+        if (auto webView = view.try_as<winrt::WebView>()) {
121
+            if (commandId == L"goForward") {
122
+                if (webView.CanGoForward()) {
123
+                    webView.GoForward();
124
+                }
125
+            }
126
+            else if (commandId == L"goBack") {
127
+                if (webView.CanGoBack()) {
128
+                    webView.GoBack();
129
+                }
130
+            }
131
+            else if (commandId == L"reload") {
132
+                webView.Refresh();
133
+            }
134
+            else if (commandId == L"stopLoading") {
135
+                webView.Stop();
136
+            }
137
+            else if (commandId == L"injectJavaScript") {
138
+                webView.InvokeScriptAsync(L"eval", { winrt::to_hstring(commandArgs[0].AsString()) });
139
+            } else if(commandId == L"postMessage") {
140
+                m_reactWebView.PostMessage(winrt::to_hstring(commandArgs[0].AsString()));
141
+            }
142
+        }
143
+    }
144
+
144 145
 } // namespace winrt::ReactWebView::implementation

+ 0
- 0
windows/ReactNativeWebView/ReactWebViewManager.h Zobrazit soubor


Některé soubory nejsou zobrazny, neboť je v této revizi změněno mnoho souborů