ソースを参照

Merge branch 'master' of github.com:react-native-community/react-native-webview

Erik Haider Forsén 4 年 前
コミット
6fe5fc8878
共有99 個のファイルを変更した17419 個の追加14150 個の削除を含む
  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. 67
    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. 225
    13
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
  12. 152
    71
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java
  13. 0
    0
      apple/RNCWKProcessPoolManager.h
  14. 0
    0
      apple/RNCWKProcessPoolManager.m
  15. 2
    0
      apple/RNCWebView.h
  16. 92
    19
      apple/RNCWebView.m
  17. 0
    0
      apple/RNCWebViewManager.h
  18. 2
    0
      apple/RNCWebViewManager.m
  19. 1
    1
      docs/Custom-Android.md
  20. 5
    11
      docs/Getting-Started.md
  21. 45
    14
      docs/Guide.md
  22. 5
    1
      docs/README.portuguese.md
  23. 141
    80
      docs/Reference.md
  24. 28
    0
      example/App.tsx
  25. 7
    0
      example/android/app/src/main/java/com/example/MainApplication.java
  26. 4
    4
      example/android/build.gradle
  27. 1
    1
      example/android/gradle/wrapper/gradle-wrapper.properties
  28. 2
    2
      example/android/gradlew
  29. 100
    100
      example/android/gradlew.bat
  30. 9
    0
      example/assets/test.html
  31. 55
    0
      example/examples/Downloads.tsx
  32. 28
    27
      example/examples/Injection.tsx
  33. 16
    0
      example/examples/LocalPageLoad.tsx
  34. 6
    6
      example/ios/Podfile
  35. 181
    157
      example/ios/Podfile.lock
  36. 11
    7
      example/ios/example.xcodeproj/project.pbxproj
  37. 2
    43
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme
  38. 2
    43
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme
  39. 42
    0
      example/macos/Podfile
  40. 199
    0
      example/macos/Podfile.lock
  41. 0
    7
      example/macos/example-iOS/AppDelegate.h
  42. 0
    7
      example/macos/example-iOS/AppDelegate.m
  43. 0
    0
      example/macos/example-iOS/Base.lproj/LaunchScreen.xib
  44. 0
    15
      example/macos/example-iOS/Images.xcassets/AppIcon.appiconset/Contents.json
  45. 0
    0
      example/macos/example-iOS/Images.xcassets/Contents.json
  46. 1
    1
      example/macos/example-iOS/Info.plist
  47. 0
    7
      example/macos/example-iOS/main.m
  48. 0
    7
      example/macos/example-macOS/AppDelegate.h
  49. 0
    7
      example/macos/example-macOS/AppDelegate.m
  50. 58
    0
      example/macos/example-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json
  51. 6
    0
      example/macos/example-macOS/Assets.xcassets/Contents.json
  52. 25
    21
      example/macos/example-macOS/Base.lproj/Main.storyboard
  53. 17
    15
      example/macos/example-macOS/Info.plist
  54. 0
    7
      example/macos/example-macOS/ViewController.h
  55. 0
    7
      example/macos/example-macOS/ViewController.m
  56. 12
    0
      example/macos/example-macOS/example.entitlements
  57. 0
    7
      example/macos/example-macOS/main.m
  58. 606
    1569
      example/macos/example.xcodeproj/project.pbxproj
  59. 5
    19
      example/macos/example.xcodeproj/xcshareddata/xcschemes/example-iOS.xcscheme
  60. 8
    22
      example/macos/example.xcodeproj/xcshareddata/xcschemes/example-macOS.xcscheme
  61. 10
    0
      example/macos/example.xcworkspace/contents.xcworkspacedata
  62. 2
    4
      example/macos/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  63. 1
    0
      example/windows/.gitignore
  64. 1
    0
      example/windows/WebViewWindows.sln
  65. 0
    5
      example/windows/WebViewWindows/App.cpp
  66. 1
    1
      example/windows/WebViewWindows/Package.appxmanifest
  67. 5
    4
      example/windows/WebViewWindows/WebViewWindows.vcxproj
  68. 1
    0
      example/windows/WebViewWindows/WebViewWindows.vcxproj.filters
  69. 24
    24
      example/windows/WebViewWindows/pch.h
  70. 1
    1
      index.d.ts
  71. 7
    7
      ios/RNCWebView.xcodeproj/project.pbxproj
  72. 12
    0
      jest-setups/jest.setup.js
  73. 1
    0
      jest-setups/jest.setup.windows.js
  74. 24
    24
      macos/RNCWebView.xcodeproj/project.pbxproj
  75. 91
    86
      package.json
  76. 2
    2
      react-native-webview.podspec
  77. 14
    0
      react-native.config.js
  78. 15
    0
      src/WebView.android.tsx
  79. 1
    0
      src/WebView.ios.tsx
  80. 18
    3
      src/WebView.tsx
  81. 266
    258
      src/WebView.windows.tsx
  82. 52
    0
      src/WebViewTypes.ts
  83. 204
    204
      windows/ReactNativeWebView.sln
  84. 15
    15
      windows/ReactNativeWebView/PropertySheet.props
  85. 3
    3
      windows/ReactNativeWebView/ReactNativeWebView.def
  86. 32
    32
      windows/ReactNativeWebView/ReactNativeWebView.filters
  87. 159
    161
      windows/ReactNativeWebView/ReactNativeWebView.vcxproj
  88. 17
    17
      windows/ReactNativeWebView/ReactPackageProvider.cpp
  89. 20
    20
      windows/ReactNativeWebView/ReactPackageProvider.h
  90. 7
    7
      windows/ReactNativeWebView/ReactPackageProvider.idl
  91. 147
    143
      windows/ReactNativeWebView/ReactWebView.cpp
  92. 36
    35
      windows/ReactNativeWebView/ReactWebView.h
  93. 7
    6
      windows/ReactNativeWebView/ReactWebView.idl
  94. 144
    143
      windows/ReactNativeWebView/ReactWebViewManager.cpp
  95. 2
    4
      windows/ReactNativeWebView/ReactWebViewManager.h
  96. 3
    3
      windows/ReactNativeWebView/packages.config
  97. 1
    1
      windows/ReactNativeWebView/pch.cpp
  98. 13
    13
      windows/ReactNativeWebView/pch.h
  99. 13711
    10587
      yarn.lock

+ 1
- 1
.circleci/config.yml ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

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

+ 67
- 0
.github/workflows/windows-ci.yml ファイルの表示

@@ -0,0 +1,67 @@
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: Install Visual Studio components
19
+      shell: powershell
20
+      run: .\.github\workflows\scripts\install-vs-features.ps1 Microsoft.VisualStudio.Component.VC.v141.x86.x64,Microsoft.VisualStudio.ComponentGroup.UWP.VC.v141
21
+
22
+    - name: Setup MSBuild
23
+      uses: microsoft/setup-msbuild@v1.0.0
24
+      with:
25
+        vs-version: 16.5
26
+       
27
+    - name: Setup NuGet
28
+      uses: NuGet/setup-nuget@v1.0.2
29
+
30
+    - name: Check node modules cache
31
+      uses: actions/cache@v1
32
+      id: yarn-cache
33
+      with:
34
+        path: ./node_modules
35
+        key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
36
+        restore-keys: |
37
+          ${{ runner.os }}-yarn-
38
+
39
+    - name: Install node modules
40
+      if: steps.yarn-cache.outputs.cache-hit != 'true'
41
+      run: yarn --pure-lockfile
42
+    
43
+    - name: yarn build
44
+      if: steps.yarn-cache.outputs.cache-hit == 'true'
45
+      run: |
46
+        yarn build
47
+        yarn tsc
48
+ 
49
+    - name: NuGet restore
50
+      run: nuget restore example\windows\WebViewWindows.sln
51
+
52
+    - name: Build x64 release
53
+      run: msbuild example\windows\WebViewWindows.sln /p:Configuration=Release /p:Platform=x64 -m
54
+
55
+    - name: Deploy
56
+      shell: powershell
57
+      run: |
58
+        cd example
59
+        Copy-Item -Path windows\x64\Release -Recurse -Destination windows\
60
+        npx react-native run-windows --arch x64 --release --no-build --no-packager
61
+
62
+    - name: Start Appium server
63
+      shell: powershell
64
+      run: Start-Process PowerShell -ArgumentList "yarn appium"
65
+      
66
+    - name: Run tests
67
+      run: yarn test:windows

+ 2
- 0
.gitignore ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

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

+ 225
- 13
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java ファイルの表示

@@ -10,6 +10,7 @@ import android.content.pm.PackageManager;
10 10
 import android.graphics.Bitmap;
11 11
 import android.graphics.Color;
12 12
 import android.Manifest;
13
+import android.net.http.SslError;
13 14
 import android.net.Uri;
14 15
 import android.os.Build;
15 16
 import android.os.Environment;
@@ -26,6 +27,7 @@ import android.webkit.CookieManager;
26 27
 import android.webkit.DownloadListener;
27 28
 import android.webkit.GeolocationPermissions;
28 29
 import android.webkit.JavascriptInterface;
30
+import android.webkit.SslErrorHandler;
29 31
 import android.webkit.PermissionRequest;
30 32
 import android.webkit.URLUtil;
31 33
 import android.webkit.ValueCallback;
@@ -41,12 +43,15 @@ import com.facebook.react.views.scroll.ScrollEvent;
41 43
 import com.facebook.react.views.scroll.ScrollEventType;
42 44
 import com.facebook.react.views.scroll.OnScrollDispatchHelper;
43 45
 import com.facebook.react.bridge.Arguments;
46
+import com.facebook.react.bridge.CatalystInstance;
44 47
 import com.facebook.react.bridge.LifecycleEventListener;
45 48
 import com.facebook.react.bridge.ReactContext;
46 49
 import com.facebook.react.bridge.ReadableArray;
47 50
 import com.facebook.react.bridge.ReadableMap;
48 51
 import com.facebook.react.bridge.ReadableMapKeySetIterator;
49 52
 import com.facebook.react.bridge.WritableMap;
53
+import com.facebook.react.bridge.WritableNativeArray;
54
+import com.facebook.react.bridge.WritableNativeMap;
50 55
 import com.facebook.react.common.MapBuilder;
51 56
 import com.facebook.react.common.build.ReactBuildConfig;
52 57
 import com.facebook.react.module.annotations.ReactModule;
@@ -106,7 +111,6 @@ import javax.annotation.Nullable;
106 111
 @ReactModule(name = RNCWebViewManager.REACT_CLASS)
107 112
 public class RNCWebViewManager extends SimpleViewManager<WebView> {
108 113
 
109
-  public static String activeUrl = null;
110 114
   public static final int COMMAND_GO_BACK = 1;
111 115
   public static final int COMMAND_GO_FORWARD = 2;
112 116
   public static final int COMMAND_RELOAD = 3;
@@ -194,6 +198,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
194 198
 
195 199
     webView.setDownloadListener(new DownloadListener() {
196 200
       public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
201
+        webView.setIgnoreErrFailedForThisURL(url);
202
+
197 203
         RNCWebViewModule module = getModule(reactContext);
198 204
 
199 205
         DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
@@ -371,6 +377,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
371 377
     view.getSettings().setMediaPlaybackRequiresUserGesture(requires);
372 378
   }
373 379
 
380
+  @ReactProp(name = "javaScriptCanOpenWindowsAutomatically")
381
+  public void setJavaScriptCanOpenWindowsAutomatically(WebView view, boolean enabled) {
382
+    view.getSettings().setJavaScriptCanOpenWindowsAutomatically(enabled);
383
+  }
384
+
374 385
   @ReactProp(name = "allowFileAccessFromFileURLs")
375 386
   public void setAllowFileAccessFromFileURLs(WebView view, boolean allow) {
376 387
     view.getSettings().setAllowFileAccessFromFileURLs(allow);
@@ -391,11 +402,31 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
391 402
     ((RNCWebView) view).setInjectedJavaScript(injectedJavaScript);
392 403
   }
393 404
 
405
+  @ReactProp(name = "injectedJavaScriptBeforeContentLoaded")
406
+  public void setInjectedJavaScriptBeforeContentLoaded(WebView view, @Nullable String injectedJavaScriptBeforeContentLoaded) {
407
+    ((RNCWebView) view).setInjectedJavaScriptBeforeContentLoaded(injectedJavaScriptBeforeContentLoaded);
408
+  }
409
+
410
+  @ReactProp(name = "injectedJavaScriptForMainFrameOnly")
411
+  public void setInjectedJavaScriptForMainFrameOnly(WebView view, boolean enabled) {
412
+    ((RNCWebView) view).setInjectedJavaScriptForMainFrameOnly(enabled);
413
+  }
414
+
415
+  @ReactProp(name = "injectedJavaScriptBeforeContentLoadedForMainFrameOnly")
416
+  public void setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(WebView view, boolean enabled) {
417
+    ((RNCWebView) view).setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(enabled);
418
+  }
419
+
394 420
   @ReactProp(name = "messagingEnabled")
395 421
   public void setMessagingEnabled(WebView view, boolean enabled) {
396 422
     ((RNCWebView) view).setMessagingEnabled(enabled);
397 423
   }
398
-   
424
+
425
+  @ReactProp(name = "messagingModuleName")
426
+  public void setMessagingModuleName(WebView view, String moduleName) {
427
+    ((RNCWebView) view).setMessagingModuleName(moduleName);
428
+  }
429
+
399 430
   @ReactProp(name = "incognito")
400 431
   public void setIncognito(WebView view, boolean enabled) {
401 432
     // Remove all previous cookies
@@ -608,6 +639,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
608 639
         if (args == null) {
609 640
           throw new RuntimeException("Arguments for loading an url are null!");
610 641
         }
642
+        ((RNCWebView) root).progressChangedFilter.setWaitingForCommandLoadUrl(false);
611 643
         root.loadUrl(args.getString(0));
612 644
         break;
613 645
       case COMMAND_FOCUS:
@@ -645,7 +677,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
645 677
         public Bitmap getDefaultVideoPoster() {
646 678
           return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
647 679
         }
648
-        
680
+
649 681
         @Override
650 682
         public void onShowCustomView(View view, CustomViewCallback callback) {
651 683
           if (mVideoView != null) {
@@ -713,6 +745,12 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
713 745
     protected boolean mLastLoadFailed = false;
714 746
     protected @Nullable
715 747
     ReadableArray mUrlPrefixesForDefaultIntent;
748
+    protected RNCWebView.ProgressChangedFilter progressChangedFilter = null;
749
+    protected @Nullable String ignoreErrFailedForThisURL = null;
750
+
751
+    public void setIgnoreErrFailedForThisURL(@Nullable String url) {
752
+      ignoreErrFailedForThisURL = url;
753
+    }
716 754
 
717 755
     @Override
718 756
     public void onPageFinished(WebView webView, String url) {
@@ -732,6 +770,9 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
732 770
       super.onPageStarted(webView, url, favicon);
733 771
       mLastLoadFailed = false;
734 772
 
773
+      RNCWebView reactWebView = (RNCWebView) webView;
774
+      reactWebView.callInjectedJavaScriptBeforeContentLoaded();       
775
+
735 776
       dispatchEvent(
736 777
         webView,
737 778
         new TopLoadingStartEvent(
@@ -741,7 +782,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
741 782
 
742 783
     @Override
743 784
     public boolean shouldOverrideUrlLoading(WebView view, String url) {
744
-      activeUrl = url;
785
+      progressChangedFilter.setWaitingForCommandLoadUrl(true);
745 786
       dispatchEvent(
746 787
         view,
747 788
         new TopShouldStartLoadWithRequestEvent(
@@ -758,12 +799,71 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
758 799
       return this.shouldOverrideUrlLoading(view, url);
759 800
     }
760 801
 
802
+    @Override
803
+    public void onReceivedSslError(final WebView webView, final SslErrorHandler handler, final SslError error) {
804
+        handler.cancel();
805
+
806
+        int code = error.getPrimaryError();
807
+        String failingUrl = error.getUrl();
808
+        String description = "";
809
+        String descriptionPrefix = "SSL error: ";
810
+
811
+        // https://developer.android.com/reference/android/net/http/SslError.html
812
+        switch (code) {
813
+          case SslError.SSL_DATE_INVALID:
814
+            description = "The date of the certificate is invalid";
815
+            break;
816
+          case SslError.SSL_EXPIRED:
817
+            description = "The certificate has expired";
818
+            break;
819
+          case SslError.SSL_IDMISMATCH:
820
+            description = "Hostname mismatch";
821
+            break;
822
+          case SslError.SSL_INVALID:
823
+            description = "A generic error occurred";
824
+            break;
825
+          case SslError.SSL_NOTYETVALID:
826
+            description = "The certificate is not yet valid";
827
+            break;
828
+          case SslError.SSL_UNTRUSTED:
829
+            description = "The certificate authority is not trusted";
830
+            break;
831
+          default: 
832
+            description = "Unknown SSL Error";
833
+            break;
834
+        }
835
+        
836
+        description = descriptionPrefix + description;
837
+
838
+        this.onReceivedError(
839
+          webView,
840
+          code,
841
+          description,
842
+          failingUrl
843
+        );
844
+    }
845
+    
761 846
     @Override
762 847
     public void onReceivedError(
763 848
       WebView webView,
764 849
       int errorCode,
765 850
       String description,
766 851
       String failingUrl) {
852
+
853
+      if (ignoreErrFailedForThisURL != null
854
+          && failingUrl.equals(ignoreErrFailedForThisURL)
855
+          && errorCode == -1
856
+          && description.equals("net::ERR_FAILED")) {
857
+
858
+        // This is a workaround for a bug in the WebView.
859
+        // See these chromium issues for more context:
860
+        // https://bugs.chromium.org/p/chromium/issues/detail?id=1023678
861
+        // https://bugs.chromium.org/p/chromium/issues/detail?id=1050635
862
+        // This entire commit should be reverted once this bug is resolved in chromium.
863
+        setIgnoreErrFailedForThisURL(null);
864
+        return;
865
+      }
866
+
767 867
       super.onReceivedError(webView, errorCode, description, failingUrl);
768 868
       mLastLoadFailed = true;
769 869
 
@@ -823,6 +923,10 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
823 923
     public void setUrlPrefixesForDefaultIntent(ReadableArray specialUrls) {
824 924
       mUrlPrefixesForDefaultIntent = specialUrls;
825 925
     }
926
+
927
+    public void setProgressChangedFilter(RNCWebView.ProgressChangedFilter filter) {
928
+      progressChangedFilter = filter;
929
+    }
826 930
   }
827 931
 
828 932
   protected static class RNCWebChromeClient extends WebChromeClient implements LifecycleEventListener {
@@ -844,6 +948,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
844 948
     protected View mVideoView;
845 949
     protected WebChromeClient.CustomViewCallback mCustomViewCallback;
846 950
 
951
+    protected RNCWebView.ProgressChangedFilter progressChangedFilter = null;
952
+
847 953
     public RNCWebChromeClient(ReactContext reactContext, WebView webView) {
848 954
       this.mReactContext = reactContext;
849 955
       this.mWebView = webView;
@@ -898,11 +1004,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
898 1004
     public void onProgressChanged(WebView webView, int newProgress) {
899 1005
       super.onProgressChanged(webView, newProgress);
900 1006
       final String url = webView.getUrl();
901
-      if (
902
-        url != null
903
-        && activeUrl != null
904
-        && !url.equals(activeUrl)
905
-      ) {
1007
+      if (progressChangedFilter.isWaitingForCommandLoadUrl()) {
906 1008
         return;
907 1009
       }
908 1010
       WritableMap event = Arguments.createMap();
@@ -941,8 +1043,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
941 1043
     public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
942 1044
       String[] acceptTypes = fileChooserParams.getAcceptTypes();
943 1045
       boolean allowMultiple = fileChooserParams.getMode() == WebChromeClient.FileChooserParams.MODE_OPEN_MULTIPLE;
944
-      Intent intent = fileChooserParams.createIntent();
945
-      return getModule(mReactContext).startPhotoPickerIntent(filePathCallback, intent, acceptTypes, allowMultiple);
1046
+      return getModule(mReactContext).startPhotoPickerIntent(filePathCallback, acceptTypes, allowMultiple);
946 1047
     }
947 1048
 
948 1049
     @Override
@@ -961,6 +1062,10 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
961 1062
     protected ViewGroup getRootView() {
962 1063
       return (ViewGroup) mReactContext.getCurrentActivity().findViewById(android.R.id.content);
963 1064
     }
1065
+
1066
+    public void setProgressChangedFilter(RNCWebView.ProgressChangedFilter filter) {
1067
+      progressChangedFilter = filter;
1068
+    }
964 1069
   }
965 1070
 
966 1071
   /**
@@ -970,12 +1075,27 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
970 1075
   protected static class RNCWebView extends WebView implements LifecycleEventListener {
971 1076
     protected @Nullable
972 1077
     String injectedJS;
1078
+    protected @Nullable
1079
+    String injectedJSBeforeContentLoaded;
1080
+
1081
+    /**
1082
+     * android.webkit.WebChromeClient fundamentally does not support JS injection into frames other
1083
+     * than the main frame, so these two properties are mostly here just for parity with iOS & macOS.
1084
+     */
1085
+    protected boolean injectedJavaScriptForMainFrameOnly = true;
1086
+    protected boolean injectedJavaScriptBeforeContentLoadedForMainFrameOnly = true;
1087
+
973 1088
     protected boolean messagingEnabled = false;
974 1089
     protected @Nullable
1090
+    String messagingModuleName;
1091
+    protected @Nullable
975 1092
     RNCWebViewClient mRNCWebViewClient;
1093
+    protected @Nullable
1094
+    CatalystInstance mCatalystInstance;
976 1095
     protected boolean sendContentSizeChangeEvents = false;
977 1096
     private OnScrollDispatchHelper mOnScrollDispatchHelper;
978 1097
     protected boolean hasScrollEvent = false;
1098
+    protected ProgressChangedFilter progressChangedFilter;
979 1099
 
980 1100
     /**
981 1101
      * WebView must be created with an context of the current activity
@@ -985,6 +1105,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
985 1105
      */
986 1106
     public RNCWebView(ThemedReactContext reactContext) {
987 1107
       super(reactContext);
1108
+      progressChangedFilter = new ProgressChangedFilter();
1109
+    }
1110
+
1111
+    public void setIgnoreErrFailedForThisURL(String url) {
1112
+      mRNCWebViewClient.setIgnoreErrFailedForThisURL(url);
988 1113
     }
989 1114
 
990 1115
     public void setSendContentSizeChangeEvents(boolean sendContentSizeChangeEvents) {
@@ -1031,6 +1156,17 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1031 1156
       super.setWebViewClient(client);
1032 1157
       if (client instanceof RNCWebViewClient) {
1033 1158
         mRNCWebViewClient = (RNCWebViewClient) client;
1159
+        mRNCWebViewClient.setProgressChangedFilter(progressChangedFilter);
1160
+      }
1161
+    }
1162
+
1163
+    WebChromeClient mWebChromeClient;
1164
+    @Override
1165
+    public void setWebChromeClient(WebChromeClient client) {
1166
+      this.mWebChromeClient = client;
1167
+      super.setWebChromeClient(client);
1168
+      if (client instanceof RNCWebChromeClient) {
1169
+        ((RNCWebChromeClient) client).setProgressChangedFilter(progressChangedFilter);
1034 1170
       }
1035 1171
     }
1036 1172
 
@@ -1043,10 +1179,30 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1043 1179
       injectedJS = js;
1044 1180
     }
1045 1181
 
1182
+    public void setInjectedJavaScriptBeforeContentLoaded(@Nullable String js) {
1183
+      injectedJSBeforeContentLoaded = js;
1184
+    }
1185
+
1186
+    public void setInjectedJavaScriptForMainFrameOnly(boolean enabled) {
1187
+      injectedJavaScriptForMainFrameOnly = enabled;
1188
+    }
1189
+
1190
+    public void setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(boolean enabled) {
1191
+      injectedJavaScriptBeforeContentLoadedForMainFrameOnly = enabled;
1192
+    }
1193
+
1046 1194
     protected RNCWebViewBridge createRNCWebViewBridge(RNCWebView webView) {
1047 1195
       return new RNCWebViewBridge(webView);
1048 1196
     }
1049 1197
 
1198
+    protected void createCatalystInstance() {
1199
+      ReactContext reactContext = (ReactContext) this.getContext();
1200
+
1201
+      if (reactContext != null) {
1202
+        mCatalystInstance = reactContext.getCatalystInstance();
1203
+      }
1204
+    }
1205
+
1050 1206
     @SuppressLint("AddJavascriptInterface")
1051 1207
     public void setMessagingEnabled(boolean enabled) {
1052 1208
       if (messagingEnabled == enabled) {
@@ -1057,11 +1213,16 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1057 1213
 
1058 1214
       if (enabled) {
1059 1215
         addJavascriptInterface(createRNCWebViewBridge(this), JAVASCRIPT_INTERFACE);
1216
+        this.createCatalystInstance();
1060 1217
       } else {
1061 1218
         removeJavascriptInterface(JAVASCRIPT_INTERFACE);
1062 1219
       }
1063 1220
     }
1064 1221
 
1222
+    public void setMessagingModuleName(String moduleName) {
1223
+      messagingModuleName = moduleName;
1224
+    }
1225
+
1065 1226
     protected void evaluateJavascriptWithFallback(String script) {
1066 1227
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
1067 1228
         evaluateJavascript(script, null);
@@ -1084,7 +1245,18 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1084 1245
       }
1085 1246
     }
1086 1247
 
1248
+    public void callInjectedJavaScriptBeforeContentLoaded() {
1249
+      if (getSettings().getJavaScriptEnabled() &&
1250
+      injectedJSBeforeContentLoaded != null &&
1251
+      !TextUtils.isEmpty(injectedJSBeforeContentLoaded)) {
1252
+        evaluateJavascriptWithFallback("(function() {\n" + injectedJSBeforeContentLoaded + ";\n})();");
1253
+      }
1254
+    }
1255
+
1087 1256
     public void onMessage(String message) {
1257
+      ReactContext reactContext = (ReactContext) this.getContext();
1258
+      RNCWebView mContext = this;
1259
+
1088 1260
       if (mRNCWebViewClient != null) {
1089 1261
         WebView webView = this;
1090 1262
         webView.post(new Runnable() {
@@ -1095,16 +1267,36 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1095 1267
             }
1096 1268
             WritableMap data = mRNCWebViewClient.createWebViewEvent(webView, webView.getUrl());
1097 1269
             data.putString("data", message);
1098
-            dispatchEvent(webView, new TopMessageEvent(webView.getId(), data));
1270
+
1271
+            if (mCatalystInstance != null) {
1272
+              mContext.sendDirectMessage(data);
1273
+            } else {
1274
+              dispatchEvent(webView, new TopMessageEvent(webView.getId(), data));
1275
+            }
1099 1276
           }
1100 1277
         });
1101 1278
       } else {
1102 1279
         WritableMap eventData = Arguments.createMap();
1103 1280
         eventData.putString("data", message);
1104
-        dispatchEvent(this, new TopMessageEvent(this.getId(), eventData));
1281
+
1282
+        if (mCatalystInstance != null) {
1283
+          this.sendDirectMessage(eventData);
1284
+        } else {
1285
+          dispatchEvent(this, new TopMessageEvent(this.getId(), eventData));
1286
+        }
1105 1287
       }
1106 1288
     }
1107 1289
 
1290
+    protected void sendDirectMessage(WritableMap data) {
1291
+      WritableNativeMap event = new WritableNativeMap();
1292
+      event.putMap("nativeEvent", data);
1293
+
1294
+      WritableNativeArray params = new WritableNativeArray();
1295
+      params.pushMap(event);
1296
+
1297
+      mCatalystInstance.callFunction(messagingModuleName, "onMessage", params);
1298
+    }
1299
+
1108 1300
     protected void onScrollChanged(int x, int y, int oldX, int oldY) {
1109 1301
       super.onScrollChanged(x, y, oldX, oldY);
1110 1302
 
@@ -1138,6 +1330,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1138 1330
       destroy();
1139 1331
     }
1140 1332
 
1333
+    @Override
1334
+    public void destroy() {
1335
+      if (mWebChromeClient != null) {
1336
+        mWebChromeClient.onHideCustomView();
1337
+      }
1338
+      super.destroy();
1339
+    }
1340
+
1141 1341
     protected class RNCWebViewBridge {
1142 1342
       RNCWebView mContext;
1143 1343
 
@@ -1154,5 +1354,17 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1154 1354
         mContext.onMessage(message);
1155 1355
       }
1156 1356
     }
1357
+
1358
+    protected static class ProgressChangedFilter {
1359
+      private boolean waitingForCommandLoadUrl = false;
1360
+
1361
+      public void setWaitingForCommandLoadUrl(boolean isWaiting) {
1362
+        waitingForCommandLoadUrl = isWaiting;
1363
+      }
1364
+
1365
+      public boolean isWaitingForCommandLoadUrl() {
1366
+        return waitingForCommandLoadUrl;
1367
+      }
1368
+    }
1157 1369
   }
1158 1370
 }

+ 152
- 71
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java ファイルの表示

@@ -11,9 +11,11 @@ import android.os.Build;
11 11
 import android.os.Environment;
12 12
 import android.os.Parcelable;
13 13
 import android.provider.MediaStore;
14
+
14 15
 import androidx.annotation.RequiresApi;
15 16
 import androidx.core.content.ContextCompat;
16 17
 import androidx.core.content.FileProvider;
18
+
17 19
 import android.util.Log;
18 20
 import android.webkit.MimeTypeMap;
19 21
 import android.webkit.ValueCallback;
@@ -42,11 +44,24 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
42 44
   private static final int PICKER = 1;
43 45
   private static final int PICKER_LEGACY = 3;
44 46
   private static final int FILE_DOWNLOAD_PERMISSION_REQUEST = 1;
45
-  final String DEFAULT_MIME_TYPES = "*/*";
46 47
   private ValueCallback<Uri> filePathCallbackLegacy;
47 48
   private ValueCallback<Uri[]> filePathCallback;
48
-  private Uri outputFileUri;
49
+  private File outputImage;
50
+  private File outputVideo;
49 51
   private DownloadManager.Request downloadRequest;
52
+
53
+  private enum MimeType {
54
+    DEFAULT("*/*"),
55
+    IMAGE("image"),
56
+    VIDEO("video");
57
+
58
+    private final String value;
59
+
60
+    MimeType(String value) {
61
+      this.value = value;
62
+    }
63
+  }
64
+
50 65
   private PermissionListener webviewFileDownloaderPermissionListener = new PermissionListener() {
51 66
     @Override
52 67
     public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
@@ -96,6 +111,16 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
96 111
       return;
97 112
     }
98 113
 
114
+    boolean imageTaken = false;
115
+    boolean videoTaken = false;
116
+
117
+    if (outputImage != null && outputImage.length() > 0) {
118
+      imageTaken = true;
119
+    }
120
+    if (outputVideo != null && outputVideo.length() > 0) {
121
+      videoTaken = true;
122
+    }
123
+
99 124
     // based off of which button was pressed, we get an activity result and a file
100 125
     // the camera activity doesn't properly return the filename* (I think?) so we use
101 126
     // this filename instead
@@ -106,23 +131,42 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
106 131
             filePathCallback.onReceiveValue(null);
107 132
           }
108 133
         } else {
109
-          Uri result[] = this.getSelectedFiles(data, resultCode);
110
-          if (result != null) {
111
-            filePathCallback.onReceiveValue(result);
134
+          if (imageTaken) {
135
+            filePathCallback.onReceiveValue(new Uri[]{getOutputUri(outputImage)});
136
+          } else if (videoTaken) {
137
+            filePathCallback.onReceiveValue(new Uri[]{getOutputUri(outputVideo)});
112 138
           } else {
113
-            filePathCallback.onReceiveValue(new Uri[]{outputFileUri});
139
+            filePathCallback.onReceiveValue(this.getSelectedFiles(data, resultCode));
114 140
           }
115 141
         }
116 142
         break;
117 143
       case PICKER_LEGACY:
118
-        Uri result = resultCode != Activity.RESULT_OK ? null : data == null ? outputFileUri : data.getData();
119
-        filePathCallbackLegacy.onReceiveValue(result);
144
+        if (resultCode != RESULT_OK) {
145
+          filePathCallbackLegacy.onReceiveValue(null);
146
+        } else {
147
+          if (imageTaken) {
148
+            filePathCallbackLegacy.onReceiveValue(getOutputUri(outputImage));
149
+          } else if (videoTaken) {
150
+            filePathCallbackLegacy.onReceiveValue(getOutputUri(outputVideo));
151
+          } else {
152
+            filePathCallbackLegacy.onReceiveValue(data.getData());
153
+          }
154
+        }
120 155
         break;
121 156
 
122 157
     }
158
+
159
+    if (outputImage != null && !imageTaken) {
160
+      outputImage.delete();
161
+    }
162
+    if (outputVideo != null && !videoTaken) {
163
+      outputVideo.delete();
164
+    }
165
+
123 166
     filePathCallback = null;
124 167
     filePathCallbackLegacy = null;
125
-    outputFileUri = null;
168
+    outputImage = null;
169
+    outputVideo = null;
126 170
   }
127 171
 
128 172
   public void onNewIntent(Intent intent) {
@@ -133,15 +177,6 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
133 177
       return null;
134 178
     }
135 179
 
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 180
     // we have multiple files selected
146 181
     if (data.getClipData() != null) {
147 182
       final int numSelectedFiles = data.getClipData().getItemCount();
@@ -151,6 +186,12 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
151 186
       }
152 187
       return result;
153 188
     }
189
+
190
+    // we have one file selected
191
+    if (data.getData() != null && resultCode == RESULT_OK && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
192
+      return WebChromeClient.FileChooserParams.parseResult(resultCode, data);
193
+    }
194
+
154 195
     return null;
155 196
   }
156 197
 
@@ -162,10 +203,16 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
162 203
 
163 204
     ArrayList<Parcelable> extraIntents = new ArrayList<>();
164 205
     if (acceptsImages(acceptType)) {
165
-      extraIntents.add(getPhotoIntent());
206
+      Intent photoIntent = getPhotoIntent();
207
+      if (photoIntent != null) {
208
+        extraIntents.add(photoIntent);
209
+      }
166 210
     }
167 211
     if (acceptsVideo(acceptType)) {
168
-      extraIntents.add(getVideoIntent());
212
+      Intent videoIntent = getVideoIntent();
213
+      if (videoIntent != null) {
214
+        extraIntents.add(videoIntent);
215
+      }
169 216
     }
170 217
     chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents.toArray(new Parcelable[]{}));
171 218
 
@@ -177,16 +224,22 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
177 224
   }
178 225
 
179 226
   @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
180
-  public boolean startPhotoPickerIntent(final ValueCallback<Uri[]> callback, final Intent intent, final String[] acceptTypes, final boolean allowMultiple) {
227
+  public boolean startPhotoPickerIntent(final ValueCallback<Uri[]> callback, final String[] acceptTypes, final boolean allowMultiple) {
181 228
     filePathCallback = callback;
182 229
 
183 230
     ArrayList<Parcelable> extraIntents = new ArrayList<>();
184
-    if (! needsCameraPermission()) {
231
+    if (!needsCameraPermission()) {
185 232
       if (acceptsImages(acceptTypes)) {
186
-        extraIntents.add(getPhotoIntent());
233
+        Intent photoIntent = getPhotoIntent();
234
+        if (photoIntent != null) {
235
+          extraIntents.add(photoIntent);
236
+        }
187 237
       }
188 238
       if (acceptsVideo(acceptTypes)) {
189
-        extraIntents.add(getVideoIntent());
239
+        Intent videoIntent = getVideoIntent();
240
+        if (videoIntent != null) {
241
+          extraIntents.add(videoIntent);
242
+        }
190 243
       }
191 244
     }
192 245
 
@@ -219,16 +272,13 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
219 272
   }
220 273
 
221 274
   public boolean grantFileDownloaderPermissions() {
222
-    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
275
+    // Permission not required for Android Q and above
276
+    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
223 277
       return true;
224 278
     }
225 279
 
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) {
280
+    boolean result = ContextCompat.checkSelfPermission(getCurrentActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
281
+    if (!result && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
232 282
       PermissionAwareActivity activity = getPermissionAwareActivity();
233 283
       activity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, FILE_DOWNLOAD_PERMISSION_REQUEST, webviewFileDownloaderPermissionListener);
234 284
     }
@@ -254,23 +304,41 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
254 304
   }
255 305
 
256 306
   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);
307
+    Intent intent = null;
308
+
309
+    try {
310
+      outputImage = getCapturedFile(MimeType.IMAGE);
311
+      Uri outputImageUri = getOutputUri(outputImage);
312
+      intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
313
+      intent.putExtra(MediaStore.EXTRA_OUTPUT, outputImageUri);
314
+    } catch (IOException | IllegalArgumentException e) {
315
+      Log.e("CREATE FILE", "Error occurred while creating the File", e);
316
+      e.printStackTrace();
317
+    }
318
+
260 319
     return intent;
261 320
   }
262 321
 
263 322
   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);
323
+    Intent intent = null;
324
+
325
+    try {
326
+      outputVideo = getCapturedFile(MimeType.VIDEO);
327
+      Uri outputVideoUri = getOutputUri(outputVideo);
328
+      intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
329
+      intent.putExtra(MediaStore.EXTRA_OUTPUT, outputVideoUri);
330
+    } catch (IOException | IllegalArgumentException e) {
331
+      Log.e("CREATE FILE", "Error occurred while creating the File", e);
332
+      e.printStackTrace();
333
+    }
334
+    
267 335
     return intent;
268 336
   }
269 337
 
270 338
   private Intent getFileChooserIntent(String acceptTypes) {
271 339
     String _acceptTypes = acceptTypes;
272 340
     if (acceptTypes.isEmpty()) {
273
-      _acceptTypes = DEFAULT_MIME_TYPES;
341
+      _acceptTypes = MimeType.DEFAULT.value;
274 342
     }
275 343
     if (acceptTypes.matches("\\.\\w+")) {
276 344
       _acceptTypes = getMimeTypeFromExtension(acceptTypes.replace(".", ""));
@@ -284,7 +352,7 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
284 352
   private Intent getFileChooserIntent(String[] acceptTypes, boolean allowMultiple) {
285 353
     Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
286 354
     intent.addCategory(Intent.CATEGORY_OPENABLE);
287
-    intent.setType("*/*");
355
+    intent.setType(MimeType.DEFAULT.value);
288 356
     intent.putExtra(Intent.EXTRA_MIME_TYPES, getAcceptedMimeType(acceptTypes));
289 357
     intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, allowMultiple);
290 358
     return intent;
@@ -295,25 +363,33 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
295 363
     if (types.matches("\\.\\w+")) {
296 364
       mimeType = getMimeTypeFromExtension(types.replace(".", ""));
297 365
     }
298
-    return mimeType.isEmpty() || mimeType.toLowerCase().contains("image");
366
+    return mimeType.isEmpty() || mimeType.toLowerCase().contains(MimeType.IMAGE.value);
299 367
   }
300 368
 
301 369
   private Boolean acceptsImages(String[] types) {
302 370
     String[] mimeTypes = getAcceptedMimeType(types);
303
-    return isArrayEmpty(mimeTypes) || arrayContainsString(mimeTypes, "image");
371
+    return arrayContainsString(mimeTypes, MimeType.DEFAULT.value) || arrayContainsString(mimeTypes, MimeType.IMAGE.value);
304 372
   }
305 373
 
306 374
   private Boolean acceptsVideo(String types) {
375
+    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
376
+      return false;
377
+    }
378
+
307 379
     String mimeType = types;
308 380
     if (types.matches("\\.\\w+")) {
309 381
       mimeType = getMimeTypeFromExtension(types.replace(".", ""));
310 382
     }
311
-    return mimeType.isEmpty() || mimeType.toLowerCase().contains("video");
383
+    return mimeType.isEmpty() || mimeType.toLowerCase().contains(MimeType.VIDEO.value);
312 384
   }
313 385
 
314 386
   private Boolean acceptsVideo(String[] types) {
387
+    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
388
+      return false;
389
+    }
390
+
315 391
     String[] mimeTypes = getAcceptedMimeType(types);
316
-    return isArrayEmpty(mimeTypes) || arrayContainsString(mimeTypes, "video");
392
+    return arrayContainsString(mimeTypes, MimeType.DEFAULT.value) || arrayContainsString(mimeTypes, MimeType.VIDEO.value);
317 393
   }
318 394
 
319 395
   private Boolean arrayContainsString(String[] array, String pattern) {
@@ -326,8 +402,8 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
326 402
   }
327 403
 
328 404
   private String[] getAcceptedMimeType(String[] types) {
329
-    if (isArrayEmpty(types)) {
330
-      return new String[]{DEFAULT_MIME_TYPES};
405
+    if (noAcceptTypesSet(types)) {
406
+      return new String[]{MimeType.DEFAULT.value};
331 407
     }
332 408
     String[] mimeTypes = new String[types.length];
333 409
     for (int i = 0; i < types.length; i++) {
@@ -335,7 +411,11 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
335 411
       // convert file extensions to mime types
336 412
       if (t.matches("\\.\\w+")) {
337 413
         String mimeType = getMimeTypeFromExtension(t.replace(".", ""));
338
-        mimeTypes[i] = mimeType;
414
+        if(mimeType != null) {
415
+          mimeTypes[i] = mimeType;
416
+        } else {
417
+          mimeTypes[i] = t;
418
+        }
339 419
       } else {
340 420
         mimeTypes[i] = t;
341 421
       }
@@ -351,15 +431,7 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
351 431
     return type;
352 432
   }
353 433
 
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
-
434
+  private Uri getOutputUri(File capturedFile) {
363 435
     // for versions below 6.0 (23) we use the old File creation & permissions model
364 436
     if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
365 437
       return Uri.fromFile(capturedFile);
@@ -370,41 +442,50 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
370 442
     return FileProvider.getUriForFile(getReactApplicationContext(), packageName + ".fileprovider", capturedFile);
371 443
   }
372 444
 
373
-  private File getCapturedFile(String intentType) throws IOException {
445
+  private File getCapturedFile(MimeType mimeType) throws IOException {
374 446
     String prefix = "";
375 447
     String suffix = "";
376 448
     String dir = "";
377
-    String filename = "";
378 449
 
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;
450
+    switch (mimeType) {
451
+      case IMAGE:
452
+        prefix = "image-";
453
+        suffix = ".jpg";
454
+        dir = Environment.DIRECTORY_PICTURES;
455
+        break;
456
+      case VIDEO:
457
+        prefix = "video-";
458
+        suffix = ".mp4";
459
+        dir = Environment.DIRECTORY_MOVIES;
460
+        break;
461
+
462
+      default:
463
+        break;
387 464
     }
388 465
 
389
-    filename = prefix + String.valueOf(System.currentTimeMillis()) + suffix;
466
+    String filename = prefix + String.valueOf(System.currentTimeMillis()) + suffix;
467
+    File outputFile = null;
390 468
 
391 469
     // for versions below 6.0 (23) we use the old File creation & permissions model
392 470
     if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
393 471
       // only this Directory works on all tested Android versions
394 472
       // ctx.getExternalFilesDir(dir) was failing on Android 5.0 (sdk 21)
395 473
       File storageDir = Environment.getExternalStoragePublicDirectory(dir);
396
-      return new File(storageDir, filename);
474
+      outputFile = new File(storageDir, filename);
475
+    } else {
476
+      File storageDir = getReactApplicationContext().getExternalFilesDir(null);
477
+      outputFile = File.createTempFile(prefix, suffix, storageDir);
397 478
     }
398 479
 
399
-    File storageDir = getReactApplicationContext().getExternalFilesDir(null);
400
-    return File.createTempFile(filename, suffix, storageDir);
480
+    return outputFile;
401 481
   }
402 482
 
403
-  private Boolean isArrayEmpty(String[] arr) {
483
+  private Boolean noAcceptTypesSet(String[] types) {
404 484
     // when our array returned from getAcceptTypes() has no values set from the webview
405 485
     // i.e. <input type="file" />, without any "accept" attr
406 486
     // will be an array with one empty string element, afaik
407
-    return arr.length == 0 || (arr.length == 1 && arr[0].length() == 0);
487
+
488
+    return types.length == 0 || (types.length == 1 && types[0] != null && types[0].length() == 0);
408 489
   }
409 490
 
410 491
   private PermissionAwareActivity getPermissionAwareActivity() {

ios/RNCWKProcessPoolManager.h → apple/RNCWKProcessPoolManager.h ファイルの表示


ios/RNCWKProcessPoolManager.m → apple/RNCWKProcessPoolManager.m ファイルの表示


ios/RNCWebView.h → apple/RNCWebView.h ファイルの表示

@@ -54,11 +54,13 @@
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;
63 65
 
64 66
 + (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;

ios/RNCWebView.m → apple/RNCWebView.m ファイルの表示

@@ -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
   }
@@ -230,7 +246,7 @@ static NSDictionary* customCertificatesForHost;
230 246
   if (_applicationNameForUserAgent) {
231 247
       wkWebViewConfig.applicationNameForUserAgent = [NSString stringWithFormat:@"%@ %@", wkWebViewConfig.applicationNameForUserAgent, _applicationNameForUserAgent];
232 248
   }
233
-  
249
+
234 250
   return wkWebViewConfig;
235 251
 }
236 252
 
@@ -295,6 +311,10 @@ static NSDictionary* customCertificatesForHost;
295 311
         _webView.scrollView.delegate = nil;
296 312
 #endif // !TARGET_OS_OSX
297 313
         _webView = nil;
314
+        if (_onContentProcessDidTerminate) {
315
+          NSMutableDictionary<NSString *, id> *event = [self baseEvent];
316
+          _onContentProcessDidTerminate(event);
317
+        }
298 318
     }
299 319
 
300 320
     [super removeFromSuperview];
@@ -963,24 +983,42 @@ static NSDictionary* customCertificatesForHost;
963 983
   decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse
964 984
                     decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler
965 985
 {
986
+  WKNavigationResponsePolicy policy = WKNavigationResponsePolicyAllow;
966 987
   if (_onHttpError && navigationResponse.forMainFrame) {
967 988
     if ([navigationResponse.response isKindOfClass:[NSHTTPURLResponse class]]) {
968 989
       NSHTTPURLResponse *response = (NSHTTPURLResponse *)navigationResponse.response;
969 990
       NSInteger statusCode = response.statusCode;
970 991
 
971 992
       if (statusCode >= 400) {
972
-        NSMutableDictionary<NSString *, id> *event = [self baseEvent];
973
-        [event addEntriesFromDictionary: @{
993
+        NSMutableDictionary<NSString *, id> *httpErrorEvent = [self baseEvent];
994
+        [httpErrorEvent addEntriesFromDictionary: @{
974 995
           @"url": response.URL.absoluteString,
975 996
           @"statusCode": @(statusCode)
976 997
         }];
977 998
 
978
-        _onHttpError(event);
999
+        _onHttpError(httpErrorEvent);
1000
+      }
1001
+
1002
+      NSString *disposition = nil;
1003
+      if (@available(iOS 13, *)) {
1004
+        disposition = [response valueForHTTPHeaderField:@"Content-Disposition"];
1005
+      }
1006
+      BOOL isAttachment = disposition != nil && [disposition hasPrefix:@"attachment"];
1007
+      if (isAttachment || !navigationResponse.canShowMIMEType) {
1008
+        if (_onFileDownload) {
1009
+          policy = WKNavigationResponsePolicyCancel;
1010
+
1011
+          NSMutableDictionary<NSString *, id> *downloadEvent = [self baseEvent];
1012
+          [downloadEvent addEntriesFromDictionary: @{
1013
+            @"downloadUrl": (response.URL).absoluteString,
1014
+          }];
1015
+          _onFileDownload(downloadEvent);
1016
+        }
979 1017
       }
980 1018
     }
981
-  }  
1019
+  }
982 1020
 
983
-  decisionHandler(WKNavigationResponsePolicyAllow);
1021
+  decisionHandler(policy);
984 1022
 }
985 1023
 
986 1024
 /**
@@ -1031,6 +1069,37 @@ static NSDictionary* customCertificatesForHost;
1031 1069
   }];
1032 1070
 }
1033 1071
 
1072
+-(void)forceIgnoreSilentHardwareSwitch:(BOOL)initialSetup
1073
+{
1074
+    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==";
1075
+    NSString *scr;
1076
+    if (initialSetup) {
1077
+        scr = [NSString stringWithFormat:@"var s=new Audio('%@');s.id='wkwebviewAudio';s.controls=false;s.loop=true;s.play();document.body.appendChild(s);true", mp3Str];
1078
+    } else {
1079
+        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];
1080
+    }
1081
+    [self evaluateJS: scr thenCall: nil];
1082
+}
1083
+
1084
+-(void)disableIgnoreSilentSwitch
1085
+{
1086
+    [self evaluateJS: @"document.getElementById('wkwebviewAudio').src=null;true" thenCall: nil];
1087
+}
1088
+
1089
+-(void)appDidBecomeActive
1090
+{
1091
+    if (_ignoreSilentHardwareSwitch) {
1092
+      [self forceIgnoreSilentHardwareSwitch:false];
1093
+    }
1094
+}
1095
+
1096
+-(void)appWillResignActive
1097
+{
1098
+  if (_ignoreSilentHardwareSwitch) {
1099
+    [self disableIgnoreSilentSwitch];
1100
+  }
1101
+}
1102
+
1034 1103
 /**
1035 1104
  * Called when the navigation is complete.
1036 1105
  * @see https://fburl.com/rtys6jlb
@@ -1038,6 +1107,10 @@ static NSDictionary* customCertificatesForHost;
1038 1107
 - (void)webView:(WKWebView *)webView
1039 1108
   didFinishNavigation:(WKNavigation *)navigation
1040 1109
 {
1110
+  if (_ignoreSilentHardwareSwitch) {
1111
+    [self forceIgnoreSilentHardwareSwitch:true];
1112
+  }
1113
+
1041 1114
   if (_onLoadingFinish) {
1042 1115
     _onLoadingFinish([self baseEvent]);
1043 1116
   }
@@ -1090,11 +1163,11 @@ static NSDictionary* customCertificatesForHost;
1090 1163
 
1091 1164
 - (void)setInjectedJavaScript:(NSString *)source {
1092 1165
   _injectedJavaScript = source;
1093
-  
1166
+
1094 1167
   self.atEndScript = source == nil ? nil : [[WKUserScript alloc] initWithSource:source
1095 1168
       injectionTime:WKUserScriptInjectionTimeAtDocumentEnd
1096 1169
     forMainFrameOnly:_injectedJavaScriptForMainFrameOnly];
1097
-  
1170
+
1098 1171
   if(_webView != nil){
1099 1172
     [self resetupScripts:_webView.configuration];
1100 1173
   }
@@ -1102,11 +1175,11 @@ static NSDictionary* customCertificatesForHost;
1102 1175
 
1103 1176
 - (void)setInjectedJavaScriptBeforeContentLoaded:(NSString *)source {
1104 1177
   _injectedJavaScriptBeforeContentLoaded = source;
1105
-  
1178
+
1106 1179
   self.atStartScript = source == nil ? nil : [[WKUserScript alloc] initWithSource:source
1107 1180
        injectionTime:WKUserScriptInjectionTimeAtDocumentStart
1108 1181
     forMainFrameOnly:_injectedJavaScriptBeforeContentLoadedForMainFrameOnly];
1109
-  
1182
+
1110 1183
   if(_webView != nil){
1111 1184
     [self resetupScripts:_webView.configuration];
1112 1185
   }
@@ -1124,7 +1197,7 @@ static NSDictionary* customCertificatesForHost;
1124 1197
 
1125 1198
 - (void)setMessagingEnabled:(BOOL)messagingEnabled {
1126 1199
   _messagingEnabled = messagingEnabled;
1127
-  
1200
+
1128 1201
   self.postMessageScript = _messagingEnabled ?
1129 1202
   [
1130 1203
    [WKUserScript alloc]
@@ -1144,7 +1217,7 @@ static NSDictionary* customCertificatesForHost;
1144 1217
    forMainFrameOnly:YES
1145 1218
    ] :
1146 1219
   nil;
1147
-  
1220
+
1148 1221
   if(_webView != nil){
1149 1222
     [self resetupScripts:_webView.configuration];
1150 1223
   }
@@ -1153,7 +1226,7 @@ static NSDictionary* customCertificatesForHost;
1153 1226
 - (void)resetupScripts:(WKWebViewConfiguration *)wkWebViewConfig {
1154 1227
   [wkWebViewConfig.userContentController removeAllUserScripts];
1155 1228
   [wkWebViewConfig.userContentController removeScriptMessageHandlerForName:MessageHandlerName];
1156
-  
1229
+
1157 1230
   NSString *html5HistoryAPIShimSource = [NSString stringWithFormat:
1158 1231
     @"(function(history) {\n"
1159 1232
     "  function notify(type) {\n"
@@ -1176,7 +1249,7 @@ static NSDictionary* customCertificatesForHost;
1176 1249
   ];
1177 1250
   WKUserScript *script = [[WKUserScript alloc] initWithSource:html5HistoryAPIShimSource injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES];
1178 1251
   [wkWebViewConfig.userContentController addUserScript:script];
1179
-  
1252
+
1180 1253
   if(_sharedCookiesEnabled) {
1181 1254
     // More info to sending cookies with WKWebView
1182 1255
     // https://stackoverflow.com/questions/26573137/can-i-set-the-cookies-to-be-used-by-a-wkwebview/26577303#26577303
@@ -1245,21 +1318,21 @@ static NSDictionary* customCertificatesForHost;
1245 1318
       [wkWebViewConfig.userContentController addUserScript:cookieInScript];
1246 1319
     }
1247 1320
   }
1248
-  
1321
+
1249 1322
   if(_messagingEnabled){
1250 1323
     if (self.postMessageScript){
1251 1324
       [wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]
1252 1325
                                                                        name:MessageHandlerName];
1253 1326
       [wkWebViewConfig.userContentController addUserScript:self.postMessageScript];
1254 1327
     }
1255
-    // FIXME: For a separate (minor) PR: these two shouldn't be gated by messagingEnabled; just keeping consistency with previous behaviour.
1256
-    if (self.atStartScript) {
1257
-      [wkWebViewConfig.userContentController addUserScript:self.atStartScript];
1258
-    }
1259 1328
     if (self.atEndScript) {
1260 1329
       [wkWebViewConfig.userContentController addUserScript:self.atEndScript];
1261 1330
     }
1262 1331
   }
1332
+  // Whether or not messaging is enabled, add the startup script if it exists.
1333
+  if (self.atStartScript) {
1334
+    [wkWebViewConfig.userContentController addUserScript:self.atStartScript];
1335
+  }
1263 1336
 }
1264 1337
 
1265 1338
 - (NSURLRequest *)requestForSource:(id)json {

ios/RNCWebViewManager.h → apple/RNCWebViewManager.h ファイルの表示


ios/RNCWebViewManager.m → apple/RNCWebViewManager.m ファイルの表示

@@ -34,6 +34,7 @@ RCT_EXPORT_MODULE()
34 34
 }
35 35
 
36 36
 RCT_EXPORT_VIEW_PROPERTY(source, NSDictionary)
37
+RCT_EXPORT_VIEW_PROPERTY(onFileDownload, RCTDirectEventBlock)
37 38
 RCT_EXPORT_VIEW_PROPERTY(onLoadingStart, RCTDirectEventBlock)
38 39
 RCT_EXPORT_VIEW_PROPERTY(onLoadingFinish, RCTDirectEventBlock)
39 40
 RCT_EXPORT_VIEW_PROPERTY(onLoadingError, RCTDirectEventBlock)
@@ -46,6 +47,7 @@ RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptBeforeContentLoaded, NSString)
46 47
 RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptForMainFrameOnly, BOOL)
47 48
 RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptBeforeContentLoadedForMainFrameOnly, BOOL)
48 49
 RCT_EXPORT_VIEW_PROPERTY(javaScriptEnabled, BOOL)
50
+RCT_EXPORT_VIEW_PROPERTY(javaScriptCanOpenWindowsAutomatically, BOOL)
49 51
 RCT_EXPORT_VIEW_PROPERTY(allowFileAccessFromFileURLs, BOOL)
50 52
 RCT_EXPORT_VIEW_PROPERTY(allowsInlineMediaPlayback, BOOL)
51 53
 RCT_EXPORT_VIEW_PROPERTY(mediaPlaybackRequiresUserAction, BOOL)

+ 1
- 1
docs/Custom-Android.md ファイルの表示

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

+ 5
- 11
docs/Getting-Started.md ファイルの表示

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

+ 45
- 14
docs/Guide.md ファイルの表示

@@ -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
   ......
@@ -293,7 +315,7 @@ export default class App extends Component {
293 315
 
294 316
 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.
295 317
 
296
-By setting `injectedJavaScriptForMainFrameOnly: false`, the JavaScript injection will occur on all frames (not just the top frame) if supported for the given platform.
318
+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 319
 
298 320
 <img alt="screenshot of Github repo" width="200" src="https://user-images.githubusercontent.com/1479215/53609254-e5dc9c00-3b7a-11e9-9118-bc4e520ce6ca.png" />
299 321
 
@@ -334,10 +356,11 @@ export default class App extends Component {
334 356
 
335 357
 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 358
 
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.
359
+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 360
 
339 361
 > 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 362
 > On Android, `injectedJavaScript` runs a method on the Android WebView called `evaluateJavascriptWithFallback`
363
+> 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 364
 
342 365
 #### The `injectJavaScript` method
343 366
 
@@ -362,7 +385,7 @@ export default class App extends Component {
362 385
     return (
363 386
       <View style={{ flex: 1 }}>
364 387
         <WebView
365
-          ref={r => (this.webref = r)}
388
+          ref={(r) => (this.webref = r)}
366 389
           source={{
367 390
             uri:
368 391
               'https://github.com/react-native-community/react-native-webview',
@@ -415,7 +438,7 @@ export default class App extends Component {
415 438
       <View style={{ flex: 1 }}>
416 439
         <WebView
417 440
           source={{ html }}
418
-          onMessage={event => {
441
+          onMessage={(event) => {
419 442
             alert(event.nativeEvent.data);
420 443
           }}
421 444
         />
@@ -451,7 +474,7 @@ This will set the header on the first load, but not on subsequent page navigatio
451 474
 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 475
 
453 476
 ```jsx
454
-const CustomHeaderWebView = props => {
477
+const CustomHeaderWebView = (props) => {
455 478
   const { uri, onLoadStart, ...restProps } = props;
456 479
   const [currentURI, setURI] = useState(props.source.uri);
457 480
   const newSource = { ...props.source, uri: currentURI };
@@ -460,7 +483,7 @@ const CustomHeaderWebView = props => {
460 483
     <WebView
461 484
       {...restProps}
462 485
       source={newSource}
463
-      onShouldStartLoadWithRequest={request => {
486
+      onShouldStartLoadWithRequest={(request) => {
464 487
         // If we're loading the current URI, allow it to load
465 488
         if (request.url === currentURI) return true;
466 489
         // We're loading a new URL -- change state first
@@ -485,7 +508,7 @@ const CustomHeaderWebView = props => {
485 508
 
486 509
 You can set cookies on the React Native side using the [@react-native-community/cookies](https://github.com/react-native-community/cookies) package.
487 510
 
488
-When you do, you'll likely want to enable the [sharedCookiesEnabled](Reference#sharedCookiesEnabled) prop as well.
511
+When you do, you'll likely want to enable the [sharedCookiesEnabled](Reference.md#sharedCookiesEnabled) prop as well.
489 512
 
490 513
 ```jsx
491 514
 const App = () => {
@@ -517,3 +540,11 @@ const App = () => {
517 540
 ```
518 541
 
519 542
 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).
543
+
544
+### Hardware Silence Switch
545
+
546
+There are some inconsistencies in how the hardware silence switch is handled between embedded `audio` and `video` elements and between iOS and Android platforms.
547
+
548
+Audio on `iOS` will be muted when the hardware silence switch is in the on position, unless the `ignoreSilentHardwareSwitch` parameter is set to true.
549
+
550
+Video on `iOS` will always ignore the hardware silence switch.

+ 5
- 1
docs/README.portuguese.md ファイルの表示

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

+ 141
- 80
docs/Reference.md ファイルの表示

@@ -32,6 +32,7 @@ This document lays out the current public properties and methods for the React N
32 32
 - [`decelerationRate`](Reference.md#decelerationrate)
33 33
 - [`domStorageEnabled`](Reference.md#domstorageenabled)
34 34
 - [`javaScriptEnabled`](Reference.md#javascriptenabled)
35
+- [`javaScriptCanOpenWindowsAutomatically`](Reference.md#javascriptcanopenwindowsautomatically)
35 36
 - [`androidHardwareAccelerationDisabled`](Reference.md#androidHardwareAccelerationDisabled)
36 37
 - [`mixedContentMode`](Reference.md#mixedcontentmode)
37 38
 - [`thirdPartyCookiesEnabled`](Reference.md#thirdpartycookiesenabled)
@@ -64,6 +65,8 @@ This document lays out the current public properties and methods for the React N
64 65
 - [`allowsLinkPreview`](Reference.md#allowsLinkPreview)
65 66
 - [`sharedCookiesEnabled`](Reference.md#sharedCookiesEnabled)
66 67
 - [`textZoom`](Reference.md#textZoom)
68
+- [`ignoreSilentHardwareSwitch`](Reference.md#ignoreSilentHardwareSwitch)
69
+- [`onFileDownload`](Reference.md#onFileDownload)
67 70
 
68 71
 ## Methods Index
69 72
 
@@ -77,6 +80,7 @@ This document lays out the current public properties and methods for the React N
77 80
 - [`clearCache`](Reference.md#clearCache)
78 81
 - [`clearHistory`](Reference.md#clearHistory)
79 82
 - [`requestFocus`](Reference.md#requestFocus)
83
+- [`postMessage`](Reference.md#postMessage)
80 84
 
81 85
 ---
82 86
 
@@ -84,7 +88,7 @@ This document lays out the current public properties and methods for the React N
84 88
 
85 89
 ## Props
86 90
 
87
-### `source`
91
+### `source`[⬆](#props-index)<!-- Link generated with jump2header -->
88 92
 
89 93
 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 94
 
@@ -110,7 +114,7 @@ _Note that using static HTML requires the WebView property [originWhiteList](Ref
110 114
 
111 115
 ---
112 116
 
113
-### `automaticallyAdjustContentInsets`
117
+### `automaticallyAdjustContentInsets`[⬆](#props-index)<!-- Link generated with jump2header -->
114 118
 
115 119
 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 120
 
@@ -120,7 +124,7 @@ Controls whether to adjust the content inset for web views that are placed behin
120 124
 
121 125
 ---
122 126
 
123
-### `injectedJavaScript`
127
+### `injectedJavaScript`[⬆](#props-index)<!-- Link generated with jump2header -->
124 128
 
125 129
 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 130
 
@@ -152,7 +156,7 @@ const INJECTED_JAVASCRIPT = `(function() {
152 156
 
153 157
 ---
154 158
 
155
-### `injectedJavaScriptBeforeContentLoaded`
159
+### `injectedJavaScriptBeforeContentLoaded`[⬆](#props-index)<!-- Link generated with jump2header -->
156 160
 
157 161
 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 162
 
@@ -184,33 +188,31 @@ const INJECTED_JAVASCRIPT = `(function() {
184 188
 
185 189
 ---
186 190
 
187
-### `injectedJavaScriptForMainFrameOnly`
191
+### `injectedJavaScriptForMainFrameOnly`[⬆](#props-index)<!-- Link generated with jump2header -->
188 192
 
189
-If `true` (default), loads the `injectedJavaScript` only into the main frame.
193
+If `true` (default; mandatory for Android), loads the `injectedJavaScript` only into the main frame.
190 194
 
191
-If `false`, loads it into all frames (e.g. iframes).
195
+If `false`, (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
192 196
 
193 197
 | Type   | Required | Platform |
194 198
 | ------ | -------- | -------- |
195
-| bool | No       | iOS, macOS       |
199
+| bool | No       | iOS and macOS (only `true` supported for Android) |
196 200
 
197 201
 ---
198 202
 
199
-### `injectedJavaScriptBeforeContentLoadedForMainFrameOnly`
203
+### `injectedJavaScriptBeforeContentLoadedForMainFrameOnly`[⬆](#props-index)<!-- Link generated with jump2header -->
200 204
 
201
-If `true` (default), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
205
+If `true` (default; mandatory for Android), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
202 206
 
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.
207
+If `false`, (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
206 208
 
207 209
 | Type   | Required | Platform |
208 210
 | ------ | -------- | -------- |
209
-| bool | No       | iOS, macOS       |
211
+| bool | No       | iOS and macOS (only `true` supported for Android) |
210 212
 
211 213
 ---
212 214
 
213
-### `mediaPlaybackRequiresUserAction`
215
+### `mediaPlaybackRequiresUserAction`[⬆](#props-index)<!-- Link generated with jump2header -->
214 216
 
215 217
 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 218
 
@@ -222,7 +224,7 @@ NOTE: the default `true` value might cause some videos to hang loading on iOS. S
222 224
 
223 225
 ---
224 226
 
225
-### `nativeConfig`
227
+### `nativeConfig`[⬆](#props-index)<!-- Link generated with jump2header -->
226 228
 
227 229
 Override the native component used to render the WebView. Enables a custom native WebView which uses the same JavaScript as the original WebView.
228 230
 
@@ -238,7 +240,7 @@ The `nativeConfig` prop expects an object with the following keys:
238 240
 
239 241
 ---
240 242
 
241
-### `onError`
243
+### `onError`[⬆](#props-index)<!-- Link generated with jump2header -->
242 244
 
243 245
 Function that is invoked when the `WebView` load fails.
244 246
 
@@ -278,7 +280,7 @@ url
278 280
 
279 281
 ---
280 282
 
281
-### `onLoad`
283
+### `onLoad`[⬆](#props-index)<!-- Link generated with jump2header -->
282 284
 
283 285
 Function that is invoked when the `WebView` has finished loading.
284 286
 
@@ -311,7 +313,7 @@ url
311 313
 
312 314
 ---
313 315
 
314
-### `onLoadEnd`
316
+### `onLoadEnd`[⬆](#props-index)<!-- Link generated with jump2header -->
315 317
 
316 318
 Function that is invoked when the `WebView` load succeeds or fails.
317 319
 
@@ -345,7 +347,7 @@ url
345 347
 
346 348
 ---
347 349
 
348
-### `onLoadStart`
350
+### `onLoadStart`[⬆](#props-index)<!-- Link generated with jump2header -->
349 351
 
350 352
 Function that is invoked when the `WebView` starts loading.
351 353
 
@@ -379,7 +381,7 @@ url
379 381
 
380 382
 ---
381 383
 
382
-### `onLoadProgress`
384
+### `onLoadProgress`[⬆](#props-index)<!-- Link generated with jump2header -->
383 385
 
384 386
 Function that is invoked when the `WebView` is loading.
385 387
 
@@ -412,7 +414,7 @@ url
412 414
 
413 415
 ---
414 416
 
415
-### `onHttpError`
417
+### `onHttpError`[⬆](#props-index)<!-- Link generated with jump2header -->
416 418
 
417 419
 Function that is invoked when the `WebView` receives an http error.
418 420
 
@@ -456,7 +458,7 @@ url
456 458
 
457 459
 ---
458 460
 
459
-### `onMessage`
461
+### `onMessage`[⬆](#props-index)<!-- Link generated with jump2header -->
460 462
 
461 463
 Function that is invoked when the webview calls `window.ReactNativeWebView.postMessage`. Setting this property will inject this global into your webview.
462 464
 
@@ -470,7 +472,7 @@ To learn more, read the [Communicating between JS and Native](Guide.md#communica
470 472
 
471 473
 ---
472 474
 
473
-### `onNavigationStateChange`
475
+### `onNavigationStateChange`[⬆](#props-index)<!-- Link generated with jump2header -->
474 476
 
475 477
 Function that is invoked when the `WebView` loading starts or ends.
476 478
 
@@ -506,7 +508,7 @@ Note that this method will not be invoked on hash URL changes (e.g. from `https:
506 508
 
507 509
 ---
508 510
 
509
-### `onContentProcessDidTerminate`
511
+### `onContentProcessDidTerminate`[⬆](#props-index)<!-- Link generated with jump2header -->
510 512
 
511 513
 Function that is invoked when the `WebView` content process is terminated.
512 514
 
@@ -540,7 +542,7 @@ url
540 542
 
541 543
 ---
542 544
 
543
-### `originWhitelist`
545
+### `originWhitelist`[⬆](#props-index)<!-- Link generated with jump2header -->
544 546
 
545 547
 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 548
 
@@ -560,7 +562,7 @@ Example:
560 562
 
561 563
 ---
562 564
 
563
-### `renderError`
565
+### `renderError`[⬆](#props-index)<!-- Link generated with jump2header -->
564 566
 
565 567
 Function that returns a view to show if there's an error.
566 568
 
@@ -581,7 +583,7 @@ The function passed to `renderError` will be called with the name of the error
581 583
 
582 584
 ---
583 585
 
584
-### `renderLoading`
586
+### `renderLoading`[⬆](#props-index)<!-- Link generated with jump2header -->
585 587
 
586 588
 Function that returns a loading indicator. The startInLoadingState prop must be set to true in order to use this prop.
587 589
 
@@ -601,7 +603,7 @@ Example:
601 603
 
602 604
 ---
603 605
 
604
-### `scalesPageToFit`
606
+### `scalesPageToFit`[⬆](#props-index)<!-- Link generated with jump2header -->
605 607
 
606 608
 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 609
 
@@ -611,7 +613,7 @@ Boolean that controls whether the web content is scaled to fit the view and enab
611 613
 
612 614
 ---
613 615
 
614
-### `onShouldStartLoadWithRequest`
616
+### `onShouldStartLoadWithRequest`[⬆](#props-index)<!-- Link generated with jump2header -->
615 617
 
616 618
 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 619
 
@@ -649,7 +651,7 @@ navigationType
649 651
 
650 652
 ---
651 653
 
652
-### `startInLoadingState`
654
+### `startInLoadingState`[⬆](#props-index)<!-- Link generated with jump2header -->
653 655
 
654 656
 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 657
 
@@ -659,7 +661,7 @@ Boolean value that forces the `WebView` to show the loading view on the first lo
659 661
 
660 662
 ---
661 663
 
662
-### `style`
664
+### `style`[⬆](#props-index)<!-- Link generated with jump2header -->
663 665
 
664 666
 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 667
 
@@ -678,7 +680,7 @@ Example:
678 680
 
679 681
 ---
680 682
 
681
-### `containerStyle`
683
+### `containerStyle`[⬆](#props-index)<!-- Link generated with jump2header -->
682 684
 
683 685
 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 686
 
@@ -697,7 +699,7 @@ Example:
697 699
 
698 700
 ---
699 701
 
700
-### `decelerationRate`
702
+### `decelerationRate`[⬆](#props-index)<!-- Link generated with jump2header -->
701 703
 
702 704
 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 705
 
@@ -710,7 +712,7 @@ A floating-point number that determines how quickly the scroll view decelerates
710 712
 
711 713
 ---
712 714
 
713
-### `domStorageEnabled`
715
+### `domStorageEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
714 716
 
715 717
 Boolean value to control whether DOM Storage is enabled. Used only in Android.
716 718
 
@@ -720,7 +722,7 @@ Boolean value to control whether DOM Storage is enabled. Used only in Android.
720 722
 
721 723
 ---
722 724
 
723
-### `javaScriptEnabled`
725
+### `javaScriptEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
724 726
 
725 727
 Boolean value to enable JavaScript in the `WebView`. The default value is `true`.
726 728
 
@@ -730,7 +732,17 @@ Boolean value to enable JavaScript in the `WebView`. The default value is `true`
730 732
 
731 733
 ---
732 734
 
733
-### `androidHardwareAccelerationDisabled`
735
+### `javaScriptCanOpenWindowsAutomatically`[⬆](#props-index)<!-- Link generated with jump2header -->
736
+
737
+A Boolean value indicating whether JavaScript can open windows without user interaction. The default value is `false`.
738
+
739
+| Type | Required |
740
+| ---- | -------- |
741
+| bool | No       |
742
+
743
+---
744
+
745
+### `androidHardwareAccelerationDisabled`[⬆](#props-index)<!-- Link generated with jump2header -->
734 746
 
735 747
 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`.
736 748
 
@@ -740,7 +752,7 @@ Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android
740 752
 
741 753
 ---
742 754
 
743
-### `mixedContentMode`
755
+### `mixedContentMode`[⬆](#props-index)<!-- Link generated with jump2header -->
744 756
 
745 757
 Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin.
746 758
 
@@ -756,7 +768,7 @@ Possible values for `mixedContentMode` are:
756 768
 
757 769
 ---
758 770
 
759
-### `thirdPartyCookiesEnabled`
771
+### `thirdPartyCookiesEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
760 772
 
761 773
 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 774
 
@@ -766,7 +778,7 @@ Boolean value to enable third party cookies in the `WebView`. Used on Android Lo
766 778
 
767 779
 ---
768 780
 
769
-### `userAgent`
781
+### `userAgent`[⬆](#props-index)<!-- Link generated with jump2header -->
770 782
 
771 783
 Sets the user-agent for the `WebView`.
772 784
 
@@ -776,7 +788,7 @@ Sets the user-agent for the `WebView`.
776 788
 
777 789
 ---
778 790
 
779
-### `applicationNameForUserAgent`
791
+### `applicationNameForUserAgent`[⬆](#props-index)<!-- Link generated with jump2header -->
780 792
 
781 793
 Append to the existing user-agent. Setting `userAgent` will override this.
782 794
 
@@ -794,7 +806,7 @@ Append to the existing user-agent. Setting `userAgent` will override this.
794 806
 // 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 807
 ```
796 808
 
797
-### `allowsFullscreenVideo`
809
+### `allowsFullscreenVideo`[⬆](#props-index)<!-- Link generated with jump2header -->
798 810
 
799 811
 Boolean that determines whether videos are allowed to be played in fullscreen. The default value is `false`.
800 812
 
@@ -804,7 +816,7 @@ Boolean that determines whether videos are allowed to be played in fullscreen. T
804 816
 
805 817
 ---
806 818
 
807
-### `allowsInlineMediaPlayback`
819
+### `allowsInlineMediaPlayback`[⬆](#props-index)<!-- Link generated with jump2header -->
808 820
 
809 821
 Boolean that determines whether HTML5 videos play inline or use the native full-screen controller. The default value is `false`.
810 822
 
@@ -818,7 +830,7 @@ Boolean that determines whether HTML5 videos play inline or use the native full-
818 830
 
819 831
 ---
820 832
 
821
-### `bounces`
833
+### `bounces`[⬆](#props-index)<!-- Link generated with jump2header -->
822 834
 
823 835
 Boolean value that determines whether the web view bounces when it reaches the edge of the content. The default value is `true`.
824 836
 
@@ -828,7 +840,7 @@ Boolean value that determines whether the web view bounces when it reaches the e
828 840
 
829 841
 ---
830 842
 
831
-### `overScrollMode`
843
+### `overScrollMode`[⬆](#props-index)<!-- Link generated with jump2header -->
832 844
 
833 845
 Specifies the over scroll mode.
834 846
 
@@ -844,7 +856,7 @@ Possible values for `overScrollMode` are:
844 856
 
845 857
 ---
846 858
 
847
-### `contentInset`
859
+### `contentInset`[⬆](#props-index)<!-- Link generated with jump2header -->
848 860
 
849 861
 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 862
 
@@ -854,7 +866,7 @@ The amount by which the web view content is inset from the edges of the scroll v
854 866
 
855 867
 ---
856 868
 
857
-### `contentInsetAdjustmentBehavior`
869
+### `contentInsetAdjustmentBehavior`[⬆](#props-index)<!-- Link generated with jump2header -->
858 870
 
859 871
 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 872
 
@@ -871,7 +883,7 @@ Possible values:
871 883
 
872 884
 ---
873 885
 
874
-### `dataDetectorTypes`
886
+### `dataDetectorTypes`[⬆](#props-index)<!-- Link generated with jump2header -->
875 887
 
876 888
 Determines the types of data converted to clickable URLs in the web view's content. By default only phone numbers are detected.
877 889
 
@@ -895,7 +907,7 @@ Possible values for `dataDetectorTypes` are:
895 907
 
896 908
 ---
897 909
 
898
-### `scrollEnabled`
910
+### `scrollEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
899 911
 
900 912
 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 913
 
@@ -905,7 +917,7 @@ Boolean value that determines whether scrolling is enabled in the `WebView`. The
905 917
 
906 918
 ---
907 919
 
908
-### `directionalLockEnabled`
920
+### `directionalLockEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
909 921
 
910 922
 A Boolean value that determines whether scrolling is disabled in a particular direction.
911 923
 The default value is `true`.
@@ -916,7 +928,7 @@ The default value is `true`.
916 928
 
917 929
 ---
918 930
 
919
-### `showsHorizontalScrollIndicator`
931
+### `showsHorizontalScrollIndicator`[⬆](#props-index)<!-- Link generated with jump2header -->
920 932
 
921 933
 Boolean value that determines whether a horizontal scroll indicator is shown in the `WebView`. The default value is `true`.
922 934
 
@@ -926,7 +938,7 @@ Boolean value that determines whether a horizontal scroll indicator is shown in
926 938
 
927 939
 ---
928 940
 
929
-### `showsVerticalScrollIndicator`
941
+### `showsVerticalScrollIndicator`[⬆](#props-index)<!-- Link generated with jump2header -->
930 942
 
931 943
 Boolean value that determines whether a vertical scroll indicator is shown in the `WebView`. The default value is `true`.
932 944
 
@@ -936,7 +948,7 @@ Boolean value that determines whether a vertical scroll indicator is shown in th
936 948
 
937 949
 ---
938 950
 
939
-### `geolocationEnabled`
951
+### `geolocationEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
940 952
 
941 953
 Set whether Geolocation is enabled in the `WebView`. The default value is `false`. Used only in Android.
942 954
 
@@ -946,7 +958,7 @@ Set whether Geolocation is enabled in the `WebView`. The default value is `false
946 958
 
947 959
 ---
948 960
 
949
-### `allowFileAccessFromFileURLs`
961
+### `allowFileAccessFromFileURLs`[⬆](#props-index)<!-- Link generated with jump2header -->
950 962
 
951 963
 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 964
 
@@ -956,7 +968,7 @@ Boolean that sets whether JavaScript running in the context of a file scheme URL
956 968
 
957 969
 ---
958 970
 
959
-### `allowUniversalAccessFromFileURLs`
971
+### `allowUniversalAccessFromFileURLs`[⬆](#props-index)<!-- Link generated with jump2header -->
960 972
 
961 973
 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 974
 
@@ -966,7 +978,7 @@ Boolean that sets whether JavaScript running in the context of a file scheme URL
966 978
 
967 979
 ---
968 980
 
969
-### `allowingReadAccessToURL`
981
+### `allowingReadAccessToURL`[⬆](#props-index)<!-- Link generated with jump2header -->
970 982
 
971 983
 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 984
 
@@ -976,7 +988,7 @@ A String value that indicates which URLs the WebView's file can then reference i
976 988
 
977 989
 ---
978 990
 
979
-### `url`
991
+### `url`[⬆](#props-index)<!-- Link generated with jump2header -->
980 992
 
981 993
 **Deprecated.** Use the `source` prop instead.
982 994
 
@@ -986,7 +998,7 @@ A String value that indicates which URLs the WebView's file can then reference i
986 998
 
987 999
 ---
988 1000
 
989
-### `html`
1001
+### `html`[⬆](#props-index)<!-- Link generated with jump2header -->
990 1002
 
991 1003
 **Deprecated.** Use the `source` prop instead.
992 1004
 
@@ -996,7 +1008,7 @@ A String value that indicates which URLs the WebView's file can then reference i
996 1008
 
997 1009
 ---
998 1010
 
999
-### `keyboardDisplayRequiresUserAction`
1011
+### `keyboardDisplayRequiresUserAction`[⬆](#props-index)<!-- Link generated with jump2header -->
1000 1012
 
1001 1013
 If false, web content can programmatically display the keyboard. The default value is `true`.
1002 1014
 
@@ -1006,7 +1018,7 @@ If false, web content can programmatically display the keyboard. The default val
1006 1018
 
1007 1019
 ---
1008 1020
 
1009
-### `hideKeyboardAccessoryView`
1021
+### `hideKeyboardAccessoryView`[⬆](#props-index)<!-- Link generated with jump2header -->
1010 1022
 
1011 1023
 If true, this will hide the keyboard accessory view (< > and Done).
1012 1024
 
@@ -1016,7 +1028,7 @@ If true, this will hide the keyboard accessory view (< > and Done).
1016 1028
 
1017 1029
 ---
1018 1030
 
1019
-### `allowsBackForwardNavigationGestures`
1031
+### `allowsBackForwardNavigationGestures`[⬆](#props-index)<!-- Link generated with jump2header -->
1020 1032
 
1021 1033
 If true, this will be able horizontal swipe gestures. The default value is `false`.
1022 1034
 
@@ -1026,7 +1038,7 @@ If true, this will be able horizontal swipe gestures. The default value is `fals
1026 1038
 
1027 1039
 ---
1028 1040
 
1029
-### `incognito`
1041
+### `incognito`[⬆](#props-index)<!-- Link generated with jump2header -->
1030 1042
 
1031 1043
 Does not store any data within the lifetime of the WebView.
1032 1044
 
@@ -1036,7 +1048,7 @@ Does not store any data within the lifetime of the WebView.
1036 1048
 
1037 1049
 ---
1038 1050
 
1039
-### `allowFileAccess`
1051
+### `allowFileAccess`[⬆](#props-index)<!-- Link generated with jump2header -->
1040 1052
 
1041 1053
 If true, this will allow access to the file system via `file://` URI's. The default value is `false`.
1042 1054
 
@@ -1046,7 +1058,7 @@ If true, this will allow access to the file system via `file://` URI's. The defa
1046 1058
 
1047 1059
 ---
1048 1060
 
1049
-### `saveFormDataDisabled`
1061
+### `saveFormDataDisabled`[⬆](#props-index)<!-- Link generated with jump2header -->
1050 1062
 
1051 1063
 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 1064
 
@@ -1056,7 +1068,7 @@ Sets whether the WebView should disable saving form data. The default value is `
1056 1068
 
1057 1069
 ---
1058 1070
 
1059
-### `cacheEnabled`
1071
+### `cacheEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
1060 1072
 
1061 1073
 Sets whether WebView should use browser caching.
1062 1074
 
@@ -1066,7 +1078,7 @@ Sets whether WebView should use browser caching.
1066 1078
 
1067 1079
 ---
1068 1080
 
1069
-### `cacheMode`
1081
+### `cacheMode`[⬆](#props-index)<!-- Link generated with jump2header -->
1070 1082
 
1071 1083
 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 1084
 
@@ -1083,7 +1095,7 @@ Possible values are:
1083 1095
 
1084 1096
 ---
1085 1097
 
1086
-### `pagingEnabled`
1098
+### `pagingEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
1087 1099
 
1088 1100
 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 1101
 
@@ -1093,7 +1105,7 @@ If the value of this property is true, the scroll view stops on multiples of the
1093 1105
 
1094 1106
 ---
1095 1107
 
1096
-### `allowsLinkPreview`
1108
+### `allowsLinkPreview`[⬆](#props-index)<!-- Link generated with jump2header -->
1097 1109
 
1098 1110
 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 1111
 
@@ -1103,7 +1115,7 @@ A Boolean value that determines whether pressing on a link displays a preview of
1103 1115
 
1104 1116
 ---
1105 1117
 
1106
-### `sharedCookiesEnabled`
1118
+### `sharedCookiesEnabled`[⬆](#props-index)<!-- Link generated with jump2header -->
1107 1119
 
1108 1120
 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 1121
 
@@ -1113,7 +1125,7 @@ Set `true` if shared cookies from `[NSHTTPCookieStorage sharedHTTPCookieStorage]
1113 1125
 
1114 1126
 ---
1115 1127
 
1116
-### `textZoom`
1128
+### `textZoom`[⬆](#props-index)<!-- Link generated with jump2header -->
1117 1129
 
1118 1130
 If the user has set a custom font size in the Android system, an undesirable scale of the site interface in WebView occurs.
1119 1131
 
@@ -1127,15 +1139,57 @@ Example:
1127 1139
 
1128 1140
 `<WebView textZoom={100} />`
1129 1141
 
1142
+### `ignoreSilentHardwareSwitch`[⬆](#props-index)<!-- Link generated with jump2header -->
1143
+
1144
+(ios only)
1145
+
1146
+When set to true the hardware silent switch is ignored. Default: `false`
1147
+
1148
+| Type    | Required | Platform |
1149
+| ------- | -------- | -------- |
1150
+| boolean | No       | iOS      |
1151
+
1152
+### `onFileDownload`[⬆](#props-index)<!-- Link generated with jump2header -->
1153
+This property is iOS-only.
1154
+
1155
+Function that is invoked when the client needs to download a file.
1156
+
1157
+iOS 13+ only: If the webview navigates to a URL that results in an HTTP
1158
+response with a Content-Disposition header 'attachment...', then
1159
+this will be called.
1160
+
1161
+iOS 8+: If the MIME type indicates that the content is not renderable by the
1162
+webview, that will also cause this to be called. On iOS versions before 13,
1163
+this is the only condition that will cause this function to be called.
1164
+
1165
+The application will need to provide its own code to actually download
1166
+the file.
1167
+
1168
+If not provided, the default is to let the webview try to render the file.
1169
+
1170
+Example:
1171
+```jsx
1172
+<WebView
1173
+  source={{ uri: 'https://reactnative.dev' }}
1174
+  onFileDownload={ ( { nativeEvent: { downloadUrl } } ) => {
1175
+    // You use downloadUrl which is a string to download files however you want.
1176
+  }}
1177
+  />
1178
+```
1179
+
1180
+| Type    | Required | Platform |
1181
+| ------- | -------- | -------- |
1182
+| function | No       | iOS      |
1183
+
1130 1184
 ## Methods
1131 1185
 
1132
-### `extraNativeComponentConfig()`
1186
+### `extraNativeComponentConfig()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1133 1187
 
1134 1188
 ```javascript
1135 1189
 static extraNativeComponentConfig()
1136 1190
 ```
1137 1191
 
1138
-### `goForward()`
1192
+### `goForward()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1139 1193
 
1140 1194
 ```javascript
1141 1195
 goForward();
@@ -1143,7 +1197,7 @@ goForward();
1143 1197
 
1144 1198
 Go forward one page in the web view's history.
1145 1199
 
1146
-### `goBack()`
1200
+### `goBack()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1147 1201
 
1148 1202
 ```javascript
1149 1203
 goBack();
@@ -1151,7 +1205,7 @@ goBack();
1151 1205
 
1152 1206
 Go back one page in the web view's history.
1153 1207
 
1154
-### `reload()`
1208
+### `reload()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1155 1209
 
1156 1210
 ```javascript
1157 1211
 reload();
@@ -1159,7 +1213,7 @@ reload();
1159 1213
 
1160 1214
 Reloads the current page.
1161 1215
 
1162
-### `stopLoading()`
1216
+### `stopLoading()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1163 1217
 
1164 1218
 ```javascript
1165 1219
 stopLoading();
@@ -1167,7 +1221,7 @@ stopLoading();
1167 1221
 
1168 1222
 Stop loading the current page.
1169 1223
 
1170
-### `injectJavaScript(str)`
1224
+### `injectJavaScript(str)`[⬆](#methods-index)<!-- Link generated with jump2header -->
1171 1225
 
1172 1226
 ```javascript
1173 1227
 injectJavaScript('... javascript string ...');
@@ -1177,7 +1231,7 @@ Executes the JavaScript string.
1177 1231
 
1178 1232
 To learn more, read the [Communicating between JS and Native](Guide.md#communicating-between-js-and-native) guide.
1179 1233
 
1180
-### `requestFocus()`
1234
+### `requestFocus()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1181 1235
 
1182 1236
 ```javascript
1183 1237
 requestFocus();
@@ -1185,7 +1239,14 @@ requestFocus();
1185 1239
 
1186 1240
 Request the webView to ask for focus. (People working on TV apps might want having a look at this!)
1187 1241
 
1188
-### `clearFormData()`
1242
+### `postMessage(str)`[⬆](#methods-index)<!-- Link generated with jump2header -->
1243
+
1244
+```javascript
1245
+postMessage('message');
1246
+```
1247
+Post a message to WebView, handled by [`onMessage`](Reference.md#onmessage).
1248
+
1249
+### `clearFormData()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1189 1250
 
1190 1251
 (android only)
1191 1252
 
@@ -1195,7 +1256,7 @@ clearFormData();
1195 1256
 
1196 1257
 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 1258
 
1198
-### `clearCache(bool)`
1259
+### `clearCache(bool)`[⬆](#methods-index)<!-- Link generated with jump2header -->
1199 1260
 
1200 1261
 (android only)
1201 1262
 
@@ -1205,7 +1266,7 @@ clearCache(true);
1205 1266
 
1206 1267
 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 1268
 
1208
-### `clearHistory()`
1269
+### `clearHistory()`[⬆](#methods-index)<!-- Link generated with jump2header -->
1209 1270
 
1210 1271
 (android only)
1211 1272
 

+ 28
- 0
example/App.tsx ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示


example/macos/example/Images.xcassets/AppIcon.appiconset/Contents.json → example/macos/example-iOS/Images.xcassets/AppIcon.appiconset/Contents.json ファイルの表示

@@ -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 ファイルの表示


example/macos/example/Info.plist → example/macos/example-iOS/Info.plist ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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
ファイル差分が大きすぎるため省略します
ファイルの表示


example/macos/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme → example/macos/example.xcodeproj/xcshareddata/xcschemes/example-iOS.xcscheme ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

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

+ 24
- 24
macos/RNCWebView.xcodeproj/project.pbxproj ファイルの表示

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

+ 91
- 86
package.json ファイルの表示

@@ -1,86 +1,91 @@
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.0.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 --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.3.3",
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": "16.11.0",
33
+    "react-native": ">=0.60 <0.63"
34
+  },
35
+  "dependencies": {
36
+    "escape-string-regexp": "2.0.0",
37
+    "invariant": "2.2.4"
38
+  },
39
+  "devDependencies": {
40
+    "@babel/core": "7.4.5",
41
+    "@babel/runtime": "7.4.5",
42
+    "@react-native-community/cli": "^4.8.0",
43
+    "@react-native-community/cli-platform-android": "^4.8.0",
44
+    "@react-native-community/cli-platform-ios": "^4.8.0",
45
+    "@semantic-release/git": "7.0.16",
46
+    "@types/invariant": "^2.2.30",
47
+    "@types/jest": "24.0.18",
48
+    "@types/react": "16.9.34",
49
+    "@types/react-native": "0.62.5",
50
+    "@types/selenium-webdriver": "4.0.9",
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": "0.56.4",
65
+    "metro-react-native-babel-preset": "^0.59.0",
66
+    "react": "16.11.0",
67
+    "react-native": "0.62.2",
68
+    "react-native-macos": "0.60.0-microsoft.73",
69
+    "react-native-windows": "^0.62.0-0",
70
+    "semantic-release": "15.13.24",
71
+    "typescript": "3.8.3",
72
+    "appium": "1.17.0",
73
+    "selenium-appium": "0.0.15",
74
+    "selenium-webdriver": "4.0.0-alpha.7"
75
+  },
76
+  "repository": {
77
+    "type": "git",
78
+    "url": "https://github.com/react-native-community/react-native-webview.git"
79
+  },
80
+  "files": [
81
+    "android",
82
+    "apple",
83
+    "ios",
84
+    "macos",
85
+    "windows",
86
+    "lib",
87
+    "index.js",
88
+    "index.d.ts",
89
+    "react-native-webview.podspec"
90
+  ]
91
+}

+ 2
- 2
react-native-webview.podspec ファイルの表示

@@ -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 ファイルの表示

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

+ 15
- 0
src/WebView.android.tsx ファイルの表示

@@ -10,6 +10,8 @@ import {
10 10
   findNodeHandle,
11 11
 } from 'react-native';
12 12
 
13
+import BatchedBridge from 'react-native/Libraries/BatchedBridge/BatchedBridge';
14
+
13 15
 import invariant from 'invariant';
14 16
 
15 17
 import {
@@ -39,6 +41,11 @@ const RNCWebView = requireNativeComponent(
39 41
 ) as typeof NativeWebViewAndroid;
40 42
 const { resolveAssetSource } = Image;
41 43
 
44
+/**
45
+ * A simple counter to uniquely identify WebView instances. Do not use this for anything else.
46
+ */
47
+let uniqueRef = 0;
48
+
42 49
 /**
43 50
  * Renders a native WebView.
44 51
  */
@@ -68,8 +75,15 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
68 75
     lastErrorEvent: null,
69 76
   };
70 77
 
78
+
71 79
   webViewRef = React.createRef<NativeWebViewAndroid>();
72 80
 
81
+  messagingModuleName = `WebViewMessageHandler${uniqueRef+=1}`;
82
+
83
+  componentDidMount = () => {
84
+    BatchedBridge.registerCallableModule(this.messagingModuleName, this);
85
+  };
86
+
73 87
   getCommands = () => UIManager.getViewManagerConfig('RNCWebView').Commands;
74 88
 
75 89
   goForward = () => {
@@ -327,6 +341,7 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
327 341
         key="webViewKey"
328 342
         {...otherProps}
329 343
         messagingEnabled={typeof onMessage === 'function'}
344
+        messagingModuleName={this.messagingModuleName}
330 345
         onLoadingError={this.onLoadingError}
331 346
         onLoadingFinish={this.onLoadingFinish}
332 347
         onLoadingProgress={this.onLoadingProgress}

+ 1
- 0
src/WebView.ios.tsx ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

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

+ 52
- 0
src/WebViewTypes.ts ファイルの表示

@@ -113,6 +113,10 @@ export interface WebViewNavigation extends WebViewNativeEvent {
113 113
   mainDocumentURL?: string;
114 114
 }
115 115
 
116
+export interface FileDownload {
117
+  downloadUrl: string;
118
+}
119
+
116 120
 export type DecelerationRateConstant = 'normal' | 'fast';
117 121
 
118 122
 export interface WebViewMessage extends WebViewNativeEvent {
@@ -141,6 +145,8 @@ export type WebViewProgressEvent = NativeSyntheticEvent<
141 145
 
142 146
 export type WebViewNavigationEvent = NativeSyntheticEvent<WebViewNavigation>;
143 147
 
148
+export type FileDownloadEvent = NativeSyntheticEvent<FileDownload>;
149
+
144 150
 export type WebViewMessageEvent = NativeSyntheticEvent<WebViewMessage>;
145 151
 
146 152
 export type WebViewErrorEvent = NativeSyntheticEvent<WebViewError>;
@@ -234,6 +240,9 @@ export interface CommonNativeWebViewProps extends ViewProps {
234 240
   incognito?: boolean;
235 241
   injectedJavaScript?: string;
236 242
   injectedJavaScriptBeforeContentLoaded?: string;
243
+  injectedJavaScriptForMainFrameOnly?: boolean;
244
+  injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
245
+  javaScriptCanOpenWindowsAutomatically?: boolean;
237 246
   mediaPlaybackRequiresUserAction?: boolean;
238 247
   messagingEnabled: boolean;
239 248
   onScroll?: (event: NativeScrollEvent) => void;
@@ -272,6 +281,7 @@ export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
272 281
   saveFormDataDisabled?: boolean;
273 282
   textZoom?: number;
274 283
   thirdPartyCookiesEnabled?: boolean;
284
+  messagingModuleName?: string;
275 285
   readonly urlPrefixesForDefaultIntent?: string[];
276 286
 }
277 287
 
@@ -301,6 +311,7 @@ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
301 311
   onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void;
302 312
   injectedJavaScriptForMainFrameOnly?: boolean;
303 313
   injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
314
+  onFileDownload?: (event: FileDownloadEvent) => void;
304 315
 }
305 316
 
306 317
 export interface MacOSNativeWebViewProps extends CommonNativeWebViewProps {
@@ -511,6 +522,24 @@ export interface IOSWebViewProps extends WebViewSharedProps {
511 522
    * @platform ios
512 523
   */
513 524
   injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
525
+
526
+  /**
527
+   * Function that is invoked when the client needs to download a file.
528
+   *
529
+   * iOS 13+ only: If the webview navigates to a URL that results in an HTTP
530
+   * response with a Content-Disposition header 'attachment...', then
531
+   * this will be called.
532
+   *
533
+   * iOS 8+: If the MIME type indicates that the content is not renderable by the
534
+   * webview, that will also cause this to be called. On iOS versions before 13,
535
+   * this is the only condition that will cause this function to be called.
536
+   *
537
+   * The application will need to provide its own code to actually download
538
+   * the file.
539
+   *
540
+   * If not provided, the default is to let the webview try to render the file.
541
+   */
542
+  onFileDownload?: (event: FileDownloadEvent) => void;
514 543
 }
515 544
 
516 545
 export interface MacOSWebViewProps extends WebViewSharedProps {
@@ -795,6 +824,12 @@ export interface WebViewSharedProps extends ViewProps {
795 824
    */
796 825
   javaScriptEnabled?: boolean;
797 826
 
827
+  /**
828
+   * A Boolean value indicating whether JavaScript can open windows without user interaction.
829
+   * The default value is `false`.
830
+   */
831
+  javaScriptCanOpenWindowsAutomatically?: boolean;
832
+
798 833
   /**
799 834
    * Stylesheet object to set the style of the container view.
800 835
    */
@@ -882,6 +917,18 @@ export interface WebViewSharedProps extends ViewProps {
882 917
    */
883 918
   injectedJavaScriptBeforeContentLoaded?: string;
884 919
 
920
+  /**
921
+   * If `true` (default; mandatory for Android), loads the `injectedJavaScript` only into the main frame.
922
+   * If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
923
+   */
924
+  injectedJavaScriptForMainFrameOnly?: boolean;
925
+
926
+  /**
927
+   * If `true` (default; mandatory for Android), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
928
+   * If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
929
+   */
930
+  injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
931
+
885 932
   /**
886 933
    * Boolean value that determines whether a horizontal scroll indicator is
887 934
    * shown in the `WebView`. The default value is `true`.
@@ -926,4 +973,9 @@ export interface WebViewSharedProps extends ViewProps {
926 973
    * Should caching be enabled. Default is true.
927 974
    */
928 975
   cacheEnabled?: boolean;
976
+
977
+  /**
978
+   * Append to the existing user-agent. Overridden if `userAgent` is set.
979
+   */
980
+  applicationNameForUserAgent?: string;
929 981
 }

+ 204
- 204
windows/ReactNativeWebView.sln ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

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

+ 2
- 4
windows/ReactNativeWebView/ReactWebViewManager.h ファイルの表示

@@ -8,8 +8,6 @@
8 8
 
9 9
 namespace winrt::ReactNativeWebView::implementation {
10 10
     
11
-    enum class WebViewCommands : int32_t { GoForward = 0, GoBack = 1,  Reload = 2, StopLoading = 3, InjectJavaScript = 4 };
12
-
13 11
     class ReactWebViewManager : public winrt::implements<
14 12
         ReactWebViewManager,
15 13
         winrt::Microsoft::ReactNative::IViewManager,
@@ -41,11 +39,11 @@ namespace winrt::ReactNativeWebView::implementation {
41 39
         winrt::Microsoft::ReactNative::ConstantProviderDelegate ExportedCustomDirectEventTypeConstants() noexcept;
42 40
 
43 41
         // IViewManagerWithCommands
44
-        winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, int64_t> Commands() noexcept;
42
+        winrt::Windows::Foundation::Collections::IVectorView<winrt::hstring> Commands() noexcept;
45 43
 
46 44
         void DispatchCommand(
47 45
             winrt::Windows::UI::Xaml::FrameworkElement const& view,
48
-            int64_t commandId,
46
+            winrt::hstring const& commandId,
49 47
             winrt::Microsoft::ReactNative::IJSValueReader const& commandArgsReader) noexcept;
50 48
 
51 49
     private:

+ 3
- 3
windows/ReactNativeWebView/packages.config ファイルの表示

@@ -1,4 +1,4 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<packages>
3
-  <package id="Microsoft.Windows.CppWinRT" version="2.0.190730.2" targetFramework="native" />
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<packages>
3
+  <package id="Microsoft.Windows.CppWinRT" version="2.0.190730.2" targetFramework="native" />
4 4
 </packages>

+ 1
- 1
windows/ReactNativeWebView/pch.cpp ファイルの表示

@@ -1 +1 @@
1
-#include "pch.h"
1
+#include "pch.h"

+ 13
- 13
windows/ReactNativeWebView/pch.h ファイルの表示

@@ -1,13 +1,13 @@
1
-#pragma once
2
-
3
-#define NOMINMAX
4
-#include <unknwn.h>
5
-#include <winrt/Windows.Data.Json.h>
6
-#include <winrt/Windows.Foundation.h>
7
-#include <winrt/Windows.Foundation.Collections.h>
8
-#include <winrt/Windows.UI.Popups.h>
9
-#include <winrt/Windows.UI.Xaml.h>
10
-#include <winrt/Windows.UI.Xaml.Controls.h>
11
-#include <winrt/Windows.UI.Xaml.Markup.h>
12
-#include <winrt/Windows.UI.Xaml.Navigation.h>
13
-#include <winrt/Microsoft.ReactNative.h>
1
+#pragma once
2
+
3
+#define NOMINMAX
4
+#include <unknwn.h>
5
+#include <winrt/Windows.Data.Json.h>
6
+#include <winrt/Windows.Foundation.h>
7
+#include <winrt/Windows.Foundation.Collections.h>
8
+#include <winrt/Windows.UI.Popups.h>
9
+#include <winrt/Windows.UI.Xaml.h>
10
+#include <winrt/Windows.UI.Xaml.Controls.h>
11
+#include <winrt/Windows.UI.Xaml.Markup.h>
12
+#include <winrt/Windows.UI.Xaml.Navigation.h>
13
+#include <winrt/Microsoft.ReactNative.h>

+ 13711
- 10587
yarn.lock
ファイル差分が大きすぎるため省略します
ファイルの表示