Parcourir la source

Merge branch 'master' into android-permissions

Thibaud il y a 4 ans
Parent
révision
38f70c886c
79 fichiers modifiés avec 17484 ajouts et 17596 suppressions
  1. 12
    0
      .gitattributes
  2. 5
    11
      .github/workflows/windows-ci.yml
  3. 3
    4
      README.md
  4. 8
    0
      android/build.gradle
  5. 2
    2
      android/gradle.properties
  6. 270
    30
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
  7. 48
    7
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java
  8. 26
    0
      android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt
  9. 2
    0
      android/src/main/java/com/reactnativecommunity/webview/events/TopShouldStartLoadWithRequestEvent.kt
  10. 10
    0
      apple/RNCWebView.h
  11. 62
    40
      apple/RNCWebView.m
  12. 20
    0
      apple/RNCWebViewManager.m
  13. 1
    1
      docs/Custom-Android.md
  14. 3
    1
      docs/Debugging.md
  15. 26
    16
      docs/Guide.md
  16. 5
    1
      docs/README.portuguese.md
  17. 255
    137
      docs/Reference.md
  18. 7
    0
      example/android/app/src/main/java/com/example/MainApplication.java
  19. 4
    4
      example/android/build.gradle
  20. 1
    1
      example/android/gradle/wrapper/gradle-wrapper.properties
  21. 2
    2
      example/android/gradlew
  22. 100
    100
      example/android/gradlew.bat
  23. 28
    27
      example/examples/Injection.tsx
  24. 3
    3
      example/ios/Podfile
  25. 181
    157
      example/ios/Podfile.lock
  26. 11
    7
      example/ios/example.xcodeproj/project.pbxproj
  27. 2
    43
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme
  28. 2
    43
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme
  29. 42
    42
      example/macos/Podfile
  30. 8
    8
      example/macos/example-iOS/AppDelegate.h
  31. 35
    35
      example/macos/example-iOS/AppDelegate.m
  32. 42
    42
      example/macos/example-iOS/Base.lproj/LaunchScreen.xib
  33. 37
    37
      example/macos/example-iOS/Images.xcassets/AppIcon.appiconset/Contents.json
  34. 6
    6
      example/macos/example-iOS/Images.xcassets/Contents.json
  35. 57
    57
      example/macos/example-iOS/Info.plist
  36. 9
    9
      example/macos/example-iOS/main.m
  37. 9
    9
      example/macos/example-macOS/AppDelegate.h
  38. 32
    32
      example/macos/example-macOS/AppDelegate.m
  39. 58
    58
      example/macos/example-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json
  40. 6
    6
      example/macos/example-macOS/Assets.xcassets/Contents.json
  41. 717
    717
      example/macos/example-macOS/Base.lproj/Main.storyboard
  42. 47
    47
      example/macos/example-macOS/Info.plist
  43. 5
    5
      example/macos/example-macOS/ViewController.h
  44. 22
    22
      example/macos/example-macOS/ViewController.m
  45. 12
    12
      example/macos/example-macOS/example.entitlements
  46. 5
    5
      example/macos/example-macOS/main.m
  47. 78
    78
      example/macos/example.xcodeproj/xcshareddata/xcschemes/example-iOS.xcscheme
  48. 78
    78
      example/macos/example.xcodeproj/xcshareddata/xcschemes/example-macOS.xcscheme
  49. 1
    0
      example/windows/WebViewWindows.sln
  50. 0
    5
      example/windows/WebViewWindows/App.cpp
  51. 3
    4
      example/windows/WebViewWindows/WebViewWindows.vcxproj
  52. 24
    24
      example/windows/WebViewWindows/pch.h
  53. 24
    1
      index.d.ts
  54. 2
    0
      metro.config.windows.js
  55. 90
    91
      package.json
  56. 1
    1
      react-native-webview.podspec
  57. 14
    0
      react-native.config.js
  58. 17
    3
      src/WebView.android.tsx
  59. 18
    3
      src/WebView.tsx
  60. 266
    258
      src/WebView.windows.tsx
  61. 2
    2
      src/WebViewShared.tsx
  62. 97
    10
      src/WebViewTypes.ts
  63. 204
    204
      windows/ReactNativeWebView.sln
  64. 15
    15
      windows/ReactNativeWebView/PropertySheet.props
  65. 3
    3
      windows/ReactNativeWebView/ReactNativeWebView.def
  66. 32
    32
      windows/ReactNativeWebView/ReactNativeWebView.filters
  67. 159
    161
      windows/ReactNativeWebView/ReactNativeWebView.vcxproj
  68. 17
    17
      windows/ReactNativeWebView/ReactPackageProvider.cpp
  69. 20
    20
      windows/ReactNativeWebView/ReactPackageProvider.h
  70. 7
    7
      windows/ReactNativeWebView/ReactPackageProvider.idl
  71. 147
    143
      windows/ReactNativeWebView/ReactWebView.cpp
  72. 36
    35
      windows/ReactNativeWebView/ReactWebView.h
  73. 7
    6
      windows/ReactNativeWebView/ReactWebView.idl
  74. 144
    143
      windows/ReactNativeWebView/ReactWebViewManager.cpp
  75. 2
    4
      windows/ReactNativeWebView/ReactWebViewManager.h
  76. 3
    3
      windows/ReactNativeWebView/packages.config
  77. 1
    1
      windows/ReactNativeWebView/pch.cpp
  78. 13
    13
      windows/ReactNativeWebView/pch.h
  79. 13711
    14445
      yarn.lock

+ 12
- 0
.gitattributes Voir le fichier

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

+ 5
- 11
.github/workflows/windows-ci.yml Voir le fichier

@@ -15,17 +15,10 @@ jobs:
15 15
       with:
16 16
         node-version: '12.9.1'
17 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 18
     - name: Setup MSBuild
23 19
       uses: microsoft/setup-msbuild@v1.0.0
24 20
       with:
25 21
         vs-version: 16.5
26
-       
27
-    - name: Setup NuGet
28
-      uses: NuGet/setup-nuget@v1.0.2
29 22
 
30 23
     - name: Check node modules cache
31 24
       uses: actions/cache@v1
@@ -45,13 +38,14 @@ jobs:
45 38
       run: |
46 39
         yarn build
47 40
         yarn tsc
48
- 
49
-    - name: NuGet restore
50
-      run: nuget restore example\windows\WebViewWindows.sln
51 41
 
52 42
     - name: Build x64 release
53
-      run: msbuild example\windows\WebViewWindows.sln /p:Configuration=Release /p:Platform=x64 -m
43
+      shell: powershell
44
+      run: npx react-native run-windows --root example --arch x64 --release --no-packager --no-deploy --logging
54 45
 
46
+    # Workaround for a bug in package searching during deploy.
47
+    # The deploy script only searches windows/{*/bin/x64/Release,Release/*}, but the build step above placed the pakcages at windows/x64/Release.
48
+    # Copy the packages to Windows/Release before deploying.
55 49
     - name: Deploy
56 50
       shell: powershell
57 51
       run: |

+ 3
- 4
README.md Voir le fichier

@@ -37,12 +37,11 @@ This project follows [semantic versioning](https://semver.org/). We do not hesit
37 37
 
38 38
 Current Version: ![version](https://img.shields.io/npm/v/react-native-webview.svg)
39 39
 
40
+- [10.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v10.0.0) - Android Gradle plugin is only required when opening the project stand-alone
41
+- [9.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v9.0.0) - props updates to injectedJavaScript are no longer immutable.
40 42
 - [8.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v8.0.0) - onNavigationStateChange now triggers with hash url changes
41
-
42 43
 - [7.0.1](https://github.com/react-native-community/react-native-webview/releases/tag/v7.0.1) - Removed UIWebView
43
-
44 44
 - [6.0.**2**](https://github.com/react-native-community/react-native-webview/releases/tag/v6.0.2) - Update to AndroidX. Make sure to enable it in your project's `android/gradle.properties`. See [Getting Started Guide](docs/Getting-Started.md).
45
-
46 45
 - [5.0.**1**](https://github.com/react-native-community/react-native-webview/releases/tag/v5.0.0) - Refactored the old postMessage implementation for communication from webview to native.
47 46
 - [4.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v4.0.0) - Added cache (enabled by default).
48 47
 - [3.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v3.0.0) - WKWebview: Add shared process pool so cookies and localStorage are shared across webviews in iOS (enabled by default).
@@ -97,7 +96,7 @@ This project follows the [all-contributors](https://github.com/all-contributors/
97 96
 
98 97
 MIT
99 98
 
100
-## Traduções
99
+## Translations
101 100
 
102 101
 This readme is available in:
103 102
 

+ 8
- 0
android/build.gradle Voir le fichier

@@ -16,6 +16,14 @@ buildscript {
16 16
       classpath("com.android.tools.build:gradle:3.6.0")
17 17
       classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
18 18
     }
19
+  } else {
20
+    repositories {
21
+      jcenter()
22
+    }
23
+
24
+    dependencies {
25
+      classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
26
+    }
19 27
   }
20 28
 }
21 29
 

+ 2
- 2
android/gradle.properties Voir le fichier

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

+ 270
- 30
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java Voir le fichier

@@ -5,18 +5,18 @@ import android.annotation.TargetApi;
5 5
 import android.app.Activity;
6 6
 import android.app.DownloadManager;
7 7
 import android.content.Context;
8
-import android.content.Intent;
9 8
 import android.content.pm.ActivityInfo;
10 9
 import android.content.pm.PackageManager;
11 10
 import android.graphics.Bitmap;
12 11
 import android.graphics.Color;
13 12
 import android.Manifest;
13
+import android.net.http.SslError;
14 14
 import android.net.Uri;
15 15
 import android.os.Build;
16 16
 import android.os.Environment;
17
-import androidx.annotation.RequiresApi;
18
-import androidx.core.content.ContextCompat;
17
+import android.os.SystemClock;
19 18
 import android.text.TextUtils;
19
+import android.util.Log;
20 20
 import android.view.Gravity;
21 21
 import android.view.View;
22 22
 import android.view.ViewGroup;
@@ -27,6 +27,8 @@ import android.webkit.CookieManager;
27 27
 import android.webkit.DownloadListener;
28 28
 import android.webkit.GeolocationPermissions;
29 29
 import android.webkit.JavascriptInterface;
30
+import android.webkit.RenderProcessGoneDetail;
31
+import android.webkit.SslErrorHandler;
30 32
 import android.webkit.PermissionRequest;
31 33
 import android.webkit.URLUtil;
32 34
 import android.webkit.ValueCallback;
@@ -38,6 +40,12 @@ import android.webkit.WebView;
38 40
 import android.webkit.WebViewClient;
39 41
 import android.widget.FrameLayout;
40 42
 
43
+import androidx.annotation.Nullable;
44
+import androidx.annotation.RequiresApi;
45
+import androidx.core.content.ContextCompat;
46
+import androidx.core.util.Pair;
47
+
48
+import com.facebook.common.logging.FLog;
41 49
 import com.facebook.react.modules.core.PermissionAwareActivity;
42 50
 import com.facebook.react.modules.core.PermissionListener;
43 51
 import com.facebook.react.views.scroll.ScrollEvent;
@@ -63,6 +71,7 @@ import com.facebook.react.uimanager.annotations.ReactProp;
63 71
 import com.facebook.react.uimanager.events.ContentSizeChangeEvent;
64 72
 import com.facebook.react.uimanager.events.Event;
65 73
 import com.facebook.react.uimanager.events.EventDispatcher;
74
+import com.reactnativecommunity.webview.RNCWebViewModule.ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState;
66 75
 import com.reactnativecommunity.webview.events.TopLoadingErrorEvent;
67 76
 import com.reactnativecommunity.webview.events.TopHttpErrorEvent;
68 77
 import com.reactnativecommunity.webview.events.TopLoadingFinishEvent;
@@ -70,6 +79,7 @@ import com.reactnativecommunity.webview.events.TopLoadingProgressEvent;
70 79
 import com.reactnativecommunity.webview.events.TopLoadingStartEvent;
71 80
 import com.reactnativecommunity.webview.events.TopMessageEvent;
72 81
 import com.reactnativecommunity.webview.events.TopShouldStartLoadWithRequestEvent;
82
+import com.reactnativecommunity.webview.events.TopRenderProcessGoneEvent;
73 83
 
74 84
 import org.json.JSONException;
75 85
 import org.json.JSONObject;
@@ -84,8 +94,7 @@ import java.util.HashMap;
84 94
 import java.util.List;
85 95
 import java.util.Locale;
86 96
 import java.util.Map;
87
-
88
-import javax.annotation.Nullable;
97
+import java.util.concurrent.atomic.AtomicReference;
89 98
 
90 99
 /**
91 100
  * Manages instances of {@link WebView}
@@ -113,8 +122,8 @@ import javax.annotation.Nullable;
113 122
  */
114 123
 @ReactModule(name = RNCWebViewManager.REACT_CLASS)
115 124
 public class RNCWebViewManager extends SimpleViewManager<WebView> {
125
+  private static final String TAG = "RNCWebViewManager";
116 126
 
117
-  public static String activeUrl = null;
118 127
   public static final int COMMAND_GO_BACK = 1;
119 128
   public static final int COMMAND_GO_FORWARD = 2;
120 129
   public static final int COMMAND_RELOAD = 3;
@@ -137,6 +146,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
137 146
   // Use `webView.loadUrl("about:blank")` to reliably reset the view
138 147
   // state and release page resources (including any running JavaScript).
139 148
   protected static final String BLANK_URL = "about:blank";
149
+  protected static final int SHOULD_OVERRIDE_URL_LOADING_TIMEOUT = 250;
140 150
   protected WebViewConfig mWebViewConfig;
141 151
 
142 152
   protected RNCWebChromeClient mWebChromeClient = null;
@@ -300,6 +310,21 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
300 310
     }
301 311
   }
302 312
 
313
+  @ReactProp(name = "androidLayerType")
314
+  public void setLayerType(WebView view, String layerTypeString) {
315
+    int layerType = View.LAYER_TYPE_NONE;
316
+    switch (layerTypeString) {
317
+        case "hardware":
318
+          layerType = View.LAYER_TYPE_HARDWARE;
319
+          break;
320
+        case "software":
321
+          layerType = View.LAYER_TYPE_SOFTWARE;
322
+          break;
323
+    }
324
+    view.setLayerType(layerType, null);
325
+  }
326
+
327
+
303 328
   @ReactProp(name = "overScrollMode")
304 329
   public void setOverScrollMode(WebView view, String overScrollModeString) {
305 330
     Integer overScrollMode;
@@ -381,6 +406,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
381 406
     view.getSettings().setMediaPlaybackRequiresUserGesture(requires);
382 407
   }
383 408
 
409
+  @ReactProp(name = "javaScriptCanOpenWindowsAutomatically")
410
+  public void setJavaScriptCanOpenWindowsAutomatically(WebView view, boolean enabled) {
411
+    view.getSettings().setJavaScriptCanOpenWindowsAutomatically(enabled);
412
+  }
413
+
384 414
   @ReactProp(name = "allowFileAccessFromFileURLs")
385 415
   public void setAllowFileAccessFromFileURLs(WebView view, boolean allow) {
386 416
     view.getSettings().setAllowFileAccessFromFileURLs(allow);
@@ -401,6 +431,21 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
401 431
     ((RNCWebView) view).setInjectedJavaScript(injectedJavaScript);
402 432
   }
403 433
 
434
+  @ReactProp(name = "injectedJavaScriptBeforeContentLoaded")
435
+  public void setInjectedJavaScriptBeforeContentLoaded(WebView view, @Nullable String injectedJavaScriptBeforeContentLoaded) {
436
+    ((RNCWebView) view).setInjectedJavaScriptBeforeContentLoaded(injectedJavaScriptBeforeContentLoaded);
437
+  }
438
+
439
+  @ReactProp(name = "injectedJavaScriptForMainFrameOnly")
440
+  public void setInjectedJavaScriptForMainFrameOnly(WebView view, boolean enabled) {
441
+    ((RNCWebView) view).setInjectedJavaScriptForMainFrameOnly(enabled);
442
+  }
443
+
444
+  @ReactProp(name = "injectedJavaScriptBeforeContentLoadedForMainFrameOnly")
445
+  public void setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(WebView view, boolean enabled) {
446
+    ((RNCWebView) view).setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(enabled);
447
+  }
448
+
404 449
   @ReactProp(name = "messagingEnabled")
405 450
   public void setMessagingEnabled(WebView view, boolean enabled) {
406 451
     ((RNCWebView) view).setMessagingEnabled(enabled);
@@ -410,9 +455,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
410 455
   public void setMessagingModuleName(WebView view, String moduleName) {
411 456
     ((RNCWebView) view).setMessagingModuleName(moduleName);
412 457
   }
413
-   
458
+
414 459
   @ReactProp(name = "incognito")
415 460
   public void setIncognito(WebView view, boolean enabled) {
461
+    // Don't do anything when incognito is disabled
462
+    if (!enabled) {
463
+      return;
464
+    }
465
+
416 466
     // Remove all previous cookies
417 467
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
418 468
       CookieManager.getInstance().removeAllCookies(null);
@@ -422,14 +472,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
422 472
 
423 473
     // Disable caching
424 474
     view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
425
-    view.getSettings().setAppCacheEnabled(!enabled);
475
+    view.getSettings().setAppCacheEnabled(false);
426 476
     view.clearHistory();
427
-    view.clearCache(enabled);
477
+    view.clearCache(true);
428 478
 
429 479
     // No form data or autofill enabled
430 480
     view.clearFormData();
431
-    view.getSettings().setSavePassword(!enabled);
432
-    view.getSettings().setSaveFormData(!enabled);
481
+    view.getSettings().setSavePassword(false);
482
+    view.getSettings().setSaveFormData(false);
433 483
   }
434 484
 
435 485
   @ReactProp(name = "source")
@@ -559,6 +609,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
559 609
     export.put(TopShouldStartLoadWithRequestEvent.EVENT_NAME, MapBuilder.of("registrationName", "onShouldStartLoadWithRequest"));
560 610
     export.put(ScrollEventType.getJSEventName(ScrollEventType.SCROLL), MapBuilder.of("registrationName", "onScroll"));
561 611
     export.put(TopHttpErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onHttpError"));
612
+    export.put(TopRenderProcessGoneEvent.EVENT_NAME, MapBuilder.of("registrationName", "onRenderProcessGone"));
562 613
     return export;
563 614
   }
564 615
 
@@ -623,6 +674,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
623 674
         if (args == null) {
624 675
           throw new RuntimeException("Arguments for loading an url are null!");
625 676
         }
677
+        ((RNCWebView) root).progressChangedFilter.setWaitingForCommandLoadUrl(false);
626 678
         root.loadUrl(args.getString(0));
627 679
         break;
628 680
       case COMMAND_FOCUS:
@@ -660,7 +712,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
660 712
         public Bitmap getDefaultVideoPoster() {
661 713
           return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
662 714
         }
663
-        
715
+
664 716
         @Override
665 717
         public void onShowCustomView(View view, CustomViewCallback callback) {
666 718
           if (mVideoView != null) {
@@ -728,6 +780,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
728 780
     protected boolean mLastLoadFailed = false;
729 781
     protected @Nullable
730 782
     ReadableArray mUrlPrefixesForDefaultIntent;
783
+    protected RNCWebView.ProgressChangedFilter progressChangedFilter = null;
731 784
     protected @Nullable String ignoreErrFailedForThisURL = null;
732 785
 
733 786
     public void setIgnoreErrFailedForThisURL(@Nullable String url) {
@@ -752,6 +805,9 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
752 805
       super.onPageStarted(webView, url, favicon);
753 806
       mLastLoadFailed = false;
754 807
 
808
+      RNCWebView reactWebView = (RNCWebView) webView;
809
+      reactWebView.callInjectedJavaScriptBeforeContentLoaded();
810
+
755 811
       dispatchEvent(
756 812
         webView,
757 813
         new TopLoadingStartEvent(
@@ -761,15 +817,52 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
761 817
 
762 818
     @Override
763 819
     public boolean shouldOverrideUrlLoading(WebView view, String url) {
764
-      activeUrl = url;
765
-      dispatchEvent(
766
-        view,
767
-        new TopShouldStartLoadWithRequestEvent(
768
-          view.getId(),
769
-          createWebViewEvent(view, url)));
770
-      return true;
771
-    }
820
+      final RNCWebView rncWebView = (RNCWebView) view;
821
+      final boolean isJsDebugging = ((ReactContext) view.getContext()).getJavaScriptContextHolder().get() == 0;
822
+
823
+      if (!isJsDebugging && rncWebView.mCatalystInstance != null) {
824
+        final Pair<Integer, AtomicReference<ShouldOverrideCallbackState>> lock = RNCWebViewModule.shouldOverrideUrlLoadingLock.getNewLock();
825
+        final int lockIdentifier = lock.first;
826
+        final AtomicReference<ShouldOverrideCallbackState> lockObject = lock.second;
827
+
828
+        final WritableMap event = createWebViewEvent(view, url);
829
+        event.putInt("lockIdentifier", lockIdentifier);
830
+        rncWebView.sendDirectMessage("onShouldStartLoadWithRequest", event);
831
+
832
+        try {
833
+          assert lockObject != null;
834
+          synchronized (lockObject) {
835
+            final long startTime = SystemClock.elapsedRealtime();
836
+            while (lockObject.get() == ShouldOverrideCallbackState.UNDECIDED) {
837
+              if (SystemClock.elapsedRealtime() - startTime > SHOULD_OVERRIDE_URL_LOADING_TIMEOUT) {
838
+                FLog.w(TAG, "Did not receive response to shouldOverrideUrlLoading in time, defaulting to allow loading.");
839
+                RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);
840
+                return false;
841
+              }
842
+              lockObject.wait(SHOULD_OVERRIDE_URL_LOADING_TIMEOUT);
843
+            }
844
+          }
845
+        } catch (InterruptedException e) {
846
+          FLog.e(TAG, "shouldOverrideUrlLoading was interrupted while waiting for result.", e);
847
+          RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);
848
+          return false;
849
+        }
772 850
 
851
+        final boolean shouldOverride = lockObject.get() == ShouldOverrideCallbackState.SHOULD_OVERRIDE;
852
+        RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);
853
+
854
+        return shouldOverride;
855
+      } else {
856
+        FLog.w(TAG, "Couldn't use blocking synchronous call for onShouldStartLoadWithRequest due to debugging or missing Catalyst instance, falling back to old event-and-load.");
857
+        progressChangedFilter.setWaitingForCommandLoadUrl(true);
858
+        dispatchEvent(
859
+          view,
860
+          new TopShouldStartLoadWithRequestEvent(
861
+            view.getId(),
862
+            createWebViewEvent(view, url)));
863
+        return true;
864
+      }
865
+    }
773 866
 
774 867
     @TargetApi(Build.VERSION_CODES.N)
775 868
     @Override
@@ -778,6 +871,50 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
778 871
       return this.shouldOverrideUrlLoading(view, url);
779 872
     }
780 873
 
874
+    @Override
875
+    public void onReceivedSslError(final WebView webView, final SslErrorHandler handler, final SslError error) {
876
+        handler.cancel();
877
+
878
+        int code = error.getPrimaryError();
879
+        String failingUrl = error.getUrl();
880
+        String description = "";
881
+        String descriptionPrefix = "SSL error: ";
882
+
883
+        // https://developer.android.com/reference/android/net/http/SslError.html
884
+        switch (code) {
885
+          case SslError.SSL_DATE_INVALID:
886
+            description = "The date of the certificate is invalid";
887
+            break;
888
+          case SslError.SSL_EXPIRED:
889
+            description = "The certificate has expired";
890
+            break;
891
+          case SslError.SSL_IDMISMATCH:
892
+            description = "Hostname mismatch";
893
+            break;
894
+          case SslError.SSL_INVALID:
895
+            description = "A generic error occurred";
896
+            break;
897
+          case SslError.SSL_NOTYETVALID:
898
+            description = "The certificate is not yet valid";
899
+            break;
900
+          case SslError.SSL_UNTRUSTED:
901
+            description = "The certificate authority is not trusted";
902
+            break;
903
+          default:
904
+            description = "Unknown SSL Error";
905
+            break;
906
+        }
907
+
908
+        description = descriptionPrefix + description;
909
+
910
+        this.onReceivedError(
911
+          webView,
912
+          code,
913
+          description,
914
+          failingUrl
915
+        );
916
+    }
917
+
781 918
     @Override
782 919
     public void onReceivedError(
783 920
       WebView webView,
@@ -834,6 +971,41 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
834 971
       }
835 972
     }
836 973
 
974
+    @TargetApi(Build.VERSION_CODES.O)
975
+    @Override
976
+    public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail detail) {
977
+        // WebViewClient.onRenderProcessGone was added in O.
978
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
979
+            return false;
980
+        }
981
+        super.onRenderProcessGone(webView, detail);
982
+
983
+        if(detail.didCrash()){
984
+          Log.e("RNCWebViewManager", "The WebView rendering process crashed.");
985
+        }
986
+        else{
987
+          Log.w("RNCWebViewManager", "The WebView rendering process was killed by the system.");
988
+        }
989
+
990
+        // if webView is null, we cannot return any event
991
+        // since the view is already dead/disposed
992
+        // still prevent the app crash by returning true.
993
+        if(webView == null){
994
+          return true;
995
+        }
996
+
997
+        WritableMap event = createWebViewEvent(webView, webView.getUrl());
998
+        event.putBoolean("didCrash", detail.didCrash());
999
+
1000
+        dispatchEvent(
1001
+          webView,
1002
+          new TopRenderProcessGoneEvent(webView.getId(), event)
1003
+        );
1004
+
1005
+        // returning false would crash the app.
1006
+        return true;
1007
+    }
1008
+
837 1009
     protected void emitFinishEvent(WebView webView, String url) {
838 1010
       dispatchEvent(
839 1011
         webView,
@@ -858,6 +1030,10 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
858 1030
     public void setUrlPrefixesForDefaultIntent(ReadableArray specialUrls) {
859 1031
       mUrlPrefixesForDefaultIntent = specialUrls;
860 1032
     }
1033
+
1034
+    public void setProgressChangedFilter(RNCWebView.ProgressChangedFilter filter) {
1035
+      progressChangedFilter = filter;
1036
+    }
861 1037
   }
862 1038
 
863 1039
   protected static class RNCWebChromeClient extends WebChromeClient implements LifecycleEventListener {
@@ -902,6 +1078,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
902 1078
     // Pending Android permissions for the next request
903 1079
     protected ArrayList<String> pendingPermissions = new ArrayList<>();
904 1080
 
1081
+    protected RNCWebView.ProgressChangedFilter progressChangedFilter = null;
905 1082
 
906 1083
     public RNCWebChromeClient(ReactContext reactContext, WebView webView) {
907 1084
       this.mReactContext = reactContext;
@@ -921,11 +1098,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
921 1098
     public void onProgressChanged(WebView webView, int newProgress) {
922 1099
       super.onProgressChanged(webView, newProgress);
923 1100
       final String url = webView.getUrl();
924
-      if (
925
-        url != null
926
-        && activeUrl != null
927
-        && !url.equals(activeUrl)
928
-      ) {
1101
+      if (progressChangedFilter.isWaitingForCommandLoadUrl()) {
929 1102
         return;
930 1103
       }
931 1104
       WritableMap event = Arguments.createMap();
@@ -1136,6 +1309,10 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1136 1309
     protected ViewGroup getRootView() {
1137 1310
       return (ViewGroup) mReactContext.getCurrentActivity().findViewById(android.R.id.content);
1138 1311
     }
1312
+
1313
+    public void setProgressChangedFilter(RNCWebView.ProgressChangedFilter filter) {
1314
+      progressChangedFilter = filter;
1315
+    }
1139 1316
   }
1140 1317
 
1141 1318
   /**
@@ -1145,6 +1322,16 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1145 1322
   protected static class RNCWebView extends WebView implements LifecycleEventListener {
1146 1323
     protected @Nullable
1147 1324
     String injectedJS;
1325
+    protected @Nullable
1326
+    String injectedJSBeforeContentLoaded;
1327
+
1328
+    /**
1329
+     * android.webkit.WebChromeClient fundamentally does not support JS injection into frames other
1330
+     * than the main frame, so these two properties are mostly here just for parity with iOS & macOS.
1331
+     */
1332
+    protected boolean injectedJavaScriptForMainFrameOnly = true;
1333
+    protected boolean injectedJavaScriptBeforeContentLoadedForMainFrameOnly = true;
1334
+
1148 1335
     protected boolean messagingEnabled = false;
1149 1336
     protected @Nullable
1150 1337
     String messagingModuleName;
@@ -1155,6 +1342,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1155 1342
     protected boolean sendContentSizeChangeEvents = false;
1156 1343
     private OnScrollDispatchHelper mOnScrollDispatchHelper;
1157 1344
     protected boolean hasScrollEvent = false;
1345
+    protected ProgressChangedFilter progressChangedFilter;
1158 1346
 
1159 1347
     /**
1160 1348
      * WebView must be created with an context of the current activity
@@ -1164,6 +1352,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1164 1352
      */
1165 1353
     public RNCWebView(ThemedReactContext reactContext) {
1166 1354
       super(reactContext);
1355
+      this.createCatalystInstance();
1356
+      progressChangedFilter = new ProgressChangedFilter();
1167 1357
     }
1168 1358
 
1169 1359
     public void setIgnoreErrFailedForThisURL(String url) {
@@ -1214,6 +1404,17 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1214 1404
       super.setWebViewClient(client);
1215 1405
       if (client instanceof RNCWebViewClient) {
1216 1406
         mRNCWebViewClient = (RNCWebViewClient) client;
1407
+        mRNCWebViewClient.setProgressChangedFilter(progressChangedFilter);
1408
+      }
1409
+    }
1410
+
1411
+    WebChromeClient mWebChromeClient;
1412
+    @Override
1413
+    public void setWebChromeClient(WebChromeClient client) {
1414
+      this.mWebChromeClient = client;
1415
+      super.setWebChromeClient(client);
1416
+      if (client instanceof RNCWebChromeClient) {
1417
+        ((RNCWebChromeClient) client).setProgressChangedFilter(progressChangedFilter);
1217 1418
       }
1218 1419
     }
1219 1420
 
@@ -1226,6 +1427,18 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1226 1427
       injectedJS = js;
1227 1428
     }
1228 1429
 
1430
+    public void setInjectedJavaScriptBeforeContentLoaded(@Nullable String js) {
1431
+      injectedJSBeforeContentLoaded = js;
1432
+    }
1433
+
1434
+    public void setInjectedJavaScriptForMainFrameOnly(boolean enabled) {
1435
+      injectedJavaScriptForMainFrameOnly = enabled;
1436
+    }
1437
+
1438
+    public void setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly(boolean enabled) {
1439
+      injectedJavaScriptBeforeContentLoadedForMainFrameOnly = enabled;
1440
+    }
1441
+
1229 1442
     protected RNCWebViewBridge createRNCWebViewBridge(RNCWebView webView) {
1230 1443
       return new RNCWebViewBridge(webView);
1231 1444
     }
@@ -1248,7 +1461,6 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1248 1461
 
1249 1462
       if (enabled) {
1250 1463
         addJavascriptInterface(createRNCWebViewBridge(this), JAVASCRIPT_INTERFACE);
1251
-        this.createCatalystInstance();
1252 1464
       } else {
1253 1465
         removeJavascriptInterface(JAVASCRIPT_INTERFACE);
1254 1466
       }
@@ -1280,6 +1492,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1280 1492
       }
1281 1493
     }
1282 1494
 
1495
+    public void callInjectedJavaScriptBeforeContentLoaded() {
1496
+      if (getSettings().getJavaScriptEnabled() &&
1497
+      injectedJSBeforeContentLoaded != null &&
1498
+      !TextUtils.isEmpty(injectedJSBeforeContentLoaded)) {
1499
+        evaluateJavascriptWithFallback("(function() {\n" + injectedJSBeforeContentLoaded + ";\n})();");
1500
+      }
1501
+    }
1502
+
1283 1503
     public void onMessage(String message) {
1284 1504
       ReactContext reactContext = (ReactContext) this.getContext();
1285 1505
       RNCWebView mContext = this;
@@ -1296,7 +1516,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1296 1516
             data.putString("data", message);
1297 1517
 
1298 1518
             if (mCatalystInstance != null) {
1299
-              mContext.sendDirectMessage(data);
1519
+              mContext.sendDirectMessage("onMessage", data);
1300 1520
             } else {
1301 1521
               dispatchEvent(webView, new TopMessageEvent(webView.getId(), data));
1302 1522
             }
@@ -1307,21 +1527,21 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1307 1527
         eventData.putString("data", message);
1308 1528
 
1309 1529
         if (mCatalystInstance != null) {
1310
-          this.sendDirectMessage(eventData);
1530
+          this.sendDirectMessage("onMessage", eventData);
1311 1531
         } else {
1312 1532
           dispatchEvent(this, new TopMessageEvent(this.getId(), eventData));
1313 1533
         }
1314 1534
       }
1315 1535
     }
1316 1536
 
1317
-    protected void sendDirectMessage(WritableMap data) {
1537
+    protected void sendDirectMessage(final String method, WritableMap data) {
1318 1538
       WritableNativeMap event = new WritableNativeMap();
1319 1539
       event.putMap("nativeEvent", data);
1320 1540
 
1321 1541
       WritableNativeArray params = new WritableNativeArray();
1322 1542
       params.pushMap(event);
1323 1543
 
1324
-      mCatalystInstance.callFunction(messagingModuleName, "onMessage", params);
1544
+      mCatalystInstance.callFunction(messagingModuleName, method, params);
1325 1545
     }
1326 1546
 
1327 1547
     protected void onScrollChanged(int x, int y, int oldX, int oldY) {
@@ -1357,6 +1577,14 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1357 1577
       destroy();
1358 1578
     }
1359 1579
 
1580
+    @Override
1581
+    public void destroy() {
1582
+      if (mWebChromeClient != null) {
1583
+        mWebChromeClient.onHideCustomView();
1584
+      }
1585
+      super.destroy();
1586
+    }
1587
+
1360 1588
     protected class RNCWebViewBridge {
1361 1589
       RNCWebView mContext;
1362 1590
 
@@ -1373,5 +1601,17 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1373 1601
         mContext.onMessage(message);
1374 1602
       }
1375 1603
     }
1604
+
1605
+    protected static class ProgressChangedFilter {
1606
+      private boolean waitingForCommandLoadUrl = false;
1607
+
1608
+      public void setWaitingForCommandLoadUrl(boolean isWaiting) {
1609
+        waitingForCommandLoadUrl = isWaiting;
1610
+      }
1611
+
1612
+      public boolean isWaitingForCommandLoadUrl() {
1613
+        return waitingForCommandLoadUrl;
1614
+      }
1615
+    }
1376 1616
   }
1377 1617
 }

+ 48
- 7
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java Voir le fichier

@@ -12,9 +12,11 @@ import android.os.Environment;
12 12
 import android.os.Parcelable;
13 13
 import android.provider.MediaStore;
14 14
 
15
+import androidx.annotation.Nullable;
15 16
 import androidx.annotation.RequiresApi;
16 17
 import androidx.core.content.ContextCompat;
17 18
 import androidx.core.content.FileProvider;
19
+import androidx.core.util.Pair;
18 20
 
19 21
 import android.util.Log;
20 22
 import android.webkit.MimeTypeMap;
@@ -35,6 +37,8 @@ import java.io.File;
35 37
 import java.io.IOException;
36 38
 import java.util.ArrayList;
37 39
 import java.util.Arrays;
40
+import java.util.HashMap;
41
+import java.util.concurrent.atomic.AtomicReference;
38 42
 
39 43
 import static android.app.Activity.RESULT_OK;
40 44
 
@@ -50,6 +54,35 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
50 54
   private File outputVideo;
51 55
   private DownloadManager.Request downloadRequest;
52 56
 
57
+  protected static class ShouldOverrideUrlLoadingLock {
58
+    protected enum ShouldOverrideCallbackState {
59
+      UNDECIDED,
60
+      SHOULD_OVERRIDE,
61
+      DO_NOT_OVERRIDE,
62
+    }
63
+
64
+    private int nextLockIdentifier = 0;
65
+    private final HashMap<Integer, AtomicReference<ShouldOverrideCallbackState>> shouldOverrideLocks = new HashMap<>();
66
+
67
+    public synchronized Pair<Integer, AtomicReference<ShouldOverrideCallbackState>> getNewLock() {
68
+      final int lockIdentifier = nextLockIdentifier++;
69
+      final AtomicReference<ShouldOverrideCallbackState> shouldOverride = new AtomicReference<>(ShouldOverrideCallbackState.UNDECIDED);
70
+      shouldOverrideLocks.put(lockIdentifier, shouldOverride);
71
+      return new Pair<>(lockIdentifier, shouldOverride);
72
+    }
73
+
74
+    @Nullable
75
+    public synchronized AtomicReference<ShouldOverrideCallbackState> getLock(Integer lockIdentifier) {
76
+      return shouldOverrideLocks.get(lockIdentifier);
77
+    }
78
+
79
+    public synchronized void removeLock(Integer lockIdentifier) {
80
+      shouldOverrideLocks.remove(lockIdentifier);
81
+    }
82
+  }
83
+
84
+  protected static final ShouldOverrideUrlLoadingLock shouldOverrideUrlLoadingLock = new ShouldOverrideUrlLoadingLock();
85
+
53 86
   private enum MimeType {
54 87
     DEFAULT("*/*"),
55 88
     IMAGE("image"),
@@ -105,6 +138,17 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
105 138
     promise.resolve(result);
106 139
   }
107 140
 
141
+  @ReactMethod(isBlockingSynchronousMethod = true)
142
+  public void onShouldStartLoadWithRequestCallback(final boolean shouldStart, final int lockIdentifier) {
143
+    final AtomicReference<ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState> lockObject = shouldOverrideUrlLoadingLock.getLock(lockIdentifier);
144
+    if (lockObject != null) {
145
+      synchronized (lockObject) {
146
+        lockObject.set(shouldStart ? ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState.DO_NOT_OVERRIDE : ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState.SHOULD_OVERRIDE);
147
+        lockObject.notify();
148
+      }
149
+    }
150
+  }
151
+
108 152
   public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
109 153
 
110 154
     if (filePathCallback == null && filePathCallbackLegacy == null) {
@@ -272,16 +316,13 @@ public class RNCWebViewModule extends ReactContextBaseJavaModule implements Acti
272 316
   }
273 317
 
274 318
   public boolean grantFileDownloaderPermissions() {
275
-    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
319
+    // Permission not required for Android Q and above
320
+    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
276 321
       return true;
277 322
     }
278 323
 
279
-    boolean result = true;
280
-    if (ContextCompat.checkSelfPermission(getCurrentActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
281
-      result = false;
282
-    }
283
-
284
-    if (!result) {
324
+    boolean result = ContextCompat.checkSelfPermission(getCurrentActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
325
+    if (!result && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
285 326
       PermissionAwareActivity activity = getPermissionAwareActivity();
286 327
       activity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, FILE_DOWNLOAD_PERMISSION_REQUEST, webviewFileDownloaderPermissionListener);
287 328
     }

+ 26
- 0
android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt Voir le fichier

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

+ 2
- 0
android/src/main/java/com/reactnativecommunity/webview/events/TopShouldStartLoadWithRequestEvent.kt Voir le fichier

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

+ 10
- 0
apple/RNCWebView.h Voir le fichier

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

+ 62
- 40
apple/RNCWebView.m Voir le fichier

@@ -125,6 +125,7 @@ static NSDictionary* customCertificatesForHost;
125 125
     _showsVerticalScrollIndicator = YES;
126 126
     _directionalLockEnabled = YES;
127 127
     _automaticallyAdjustContentInsets = YES;
128
+    _autoManageStatusBarEnabled = YES;
128 129
     _contentInset = UIEdgeInsetsZero;
129 130
     _savedKeyboardDisplayRequiresUserAction = YES;
130 131
     #if !TARGET_OS_OSX
@@ -209,6 +210,10 @@ static NSDictionary* customCertificatesForHost;
209 210
     [prefs setValue:@TRUE forKey:@"allowFileAccessFromFileURLs"];
210 211
     _prefsUsed = YES;
211 212
   }
213
+  if (_javaScriptCanOpenWindowsAutomatically) {
214
+    [prefs setValue:@TRUE forKey:@"javaScriptCanOpenWindowsAutomatically"];
215
+    _prefsUsed = YES;
216
+  }
212 217
   if (_prefsUsed) {
213 218
     wkWebViewConfig.preferences = prefs;
214 219
   }
@@ -222,6 +227,14 @@ static NSDictionary* customCertificatesForHost;
222 227
   }
223 228
   wkWebViewConfig.userContentController = [WKUserContentController new];
224 229
 
230
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
231
+  if (@available(iOS 13.0, *)) {
232
+    WKWebpagePreferences *pagePrefs = [[WKWebpagePreferences alloc]init];
233
+    pagePrefs.preferredContentMode = _contentMode;
234
+    wkWebViewConfig.defaultWebpagePreferences = pagePrefs;
235
+  }
236
+#endif
237
+
225 238
   // Shim the HTML5 history API:
226 239
   [wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]
227 240
                                                             name:HistoryShimName];
@@ -263,9 +276,13 @@ static NSDictionary* customCertificatesForHost;
263 276
     _webView.UIDelegate = self;
264 277
     _webView.navigationDelegate = self;
265 278
 #if !TARGET_OS_OSX
279
+    if (_pullToRefreshEnabled) {
280
+        [self addPullToRefreshControl];
281
+    }
266 282
     _webView.scrollView.scrollEnabled = _scrollEnabled;
267 283
     _webView.scrollView.pagingEnabled = _pagingEnabled;
268
-    _webView.scrollView.bounces = _bounces;
284
+      //For UIRefreshControl to work correctly, the bounces should always be true
285
+    _webView.scrollView.bounces = _pullToRefreshEnabled || _bounces; 
269 286
     _webView.scrollView.showsHorizontalScrollIndicator = _showsHorizontalScrollIndicator;
270 287
     _webView.scrollView.showsVerticalScrollIndicator = _showsVerticalScrollIndicator;
271 288
     _webView.scrollView.directionalLockEnabled = _directionalLockEnabled;
@@ -296,7 +313,6 @@ static NSDictionary* customCertificatesForHost;
296 313
   _webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
297 314
 }
298 315
 
299
-
300 316
 - (void)removeFromSuperview
301 317
 {
302 318
     if (_webView) {
@@ -320,9 +336,13 @@ static NSDictionary* customCertificatesForHost;
320 336
 -(void)showFullScreenVideoStatusBars
321 337
 {
322 338
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
339
+    if (!_autoManageStatusBarEnabled) {
340
+      return;
341
+    }
342
+
323 343
     _isFullScreenVideoOpen = YES;
324 344
     RCTUnsafeExecuteOnMainQueueSync(^{
325
-      [RCTSharedApplication() setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
345
+      [RCTSharedApplication() setStatusBarStyle:self->_savedStatusBarStyle animated:YES];
326 346
     });
327 347
 #pragma clang diagnostic pop
328 348
 }
@@ -330,6 +350,10 @@ static NSDictionary* customCertificatesForHost;
330 350
 -(void)hideFullScreenVideoStatusBars
331 351
 {
332 352
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
353
+    if (!_autoManageStatusBarEnabled) {
354
+      return;
355
+    }
356
+
333 357
     _isFullScreenVideoOpen = NO;
334 358
     RCTUnsafeExecuteOnMainQueueSync(^{
335 359
       [RCTSharedApplication() setStatusBarHidden:self->_savedStatusBarHidden animated:YES];
@@ -865,40 +889,9 @@ static NSDictionary* customCertificatesForHost;
865 889
  * topViewController
866 890
  */
867 891
 -(UIViewController *)topViewController{
868
-    UIViewController *controller = [self topViewControllerWithRootViewController:[self getCurrentWindow].rootViewController];
869
-    return controller;
892
+    return RCTPresentedViewController();
870 893
 }
871 894
 
872
-/**
873
- * topViewControllerWithRootViewController
874
- */
875
--(UIViewController *)topViewControllerWithRootViewController:(UIViewController *)viewController{
876
-  if (viewController==nil) return nil;
877
-  if (viewController.presentedViewController!=nil) {
878
-    return [self topViewControllerWithRootViewController:viewController.presentedViewController];
879
-  } else if ([viewController isKindOfClass:[UITabBarController class]]){
880
-    return [self topViewControllerWithRootViewController:[(UITabBarController *)viewController selectedViewController]];
881
-  } else if ([viewController isKindOfClass:[UINavigationController class]]){
882
-    return [self topViewControllerWithRootViewController:[(UINavigationController *)viewController visibleViewController]];
883
-  } else {
884
-    return viewController;
885
-  }
886
-}
887
-/**
888
- * getCurrentWindow
889
- */
890
--(UIWindow *)getCurrentWindow{
891
-  UIWindow *window = [UIApplication sharedApplication].keyWindow;
892
-  if (window.windowLevel!=UIWindowLevelNormal) {
893
-    for (UIWindow *wid in [UIApplication sharedApplication].windows) {
894
-      if (window.windowLevel==UIWindowLevelNormal) {
895
-        window = wid;
896
-        break;
897
-      }
898
-    }
899
-  }
900
-  return window;
901
-}
902 895
 #endif // !TARGET_OS_OSX
903 896
 
904 897
 /**
@@ -925,13 +918,15 @@ static NSDictionary* customCertificatesForHost;
925 918
 
926 919
   WKNavigationType navigationType = navigationAction.navigationType;
927 920
   NSURLRequest *request = navigationAction.request;
921
+  BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL];
928 922
 
929 923
   if (_onShouldStartLoadWithRequest) {
930 924
     NSMutableDictionary<NSString *, id> *event = [self baseEvent];
931 925
     [event addEntriesFromDictionary: @{
932 926
       @"url": (request.URL).absoluteString,
933 927
       @"mainDocumentURL": (request.mainDocumentURL).absoluteString,
934
-      @"navigationType": navigationTypes[@(navigationType)]
928
+      @"navigationType": navigationTypes[@(navigationType)],
929
+      @"isTopFrame": @(isTopFrame)
935 930
     }];
936 931
     if (![self.delegate webView:self
937 932
       shouldStartLoadForRequest:event
@@ -943,7 +938,6 @@ static NSDictionary* customCertificatesForHost;
943 938
 
944 939
   if (_onLoadingStart) {
945 940
     // We have this check to filter out iframe requests and whatnot
946
-    BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL];
947 941
     if (isTopFrame) {
948 942
       NSMutableDictionary<NSString *, id> *event = [self baseEvent];
949 943
       [event addEntriesFromDictionary: @{
@@ -1143,6 +1137,35 @@ static NSDictionary* customCertificatesForHost;
1143 1137
   }
1144 1138
 }
1145 1139
 
1140
+- (void)addPullToRefreshControl
1141
+{
1142
+    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
1143
+    _refreshControl = refreshControl;
1144
+    [_webView.scrollView addSubview: refreshControl];
1145
+    [refreshControl addTarget:self action:@selector(pullToRefresh:) forControlEvents: UIControlEventValueChanged];
1146
+}
1147
+
1148
+- (void)pullToRefresh:(UIRefreshControl *)refreshControl
1149
+{
1150
+    [self reload];
1151
+    [refreshControl endRefreshing];
1152
+}
1153
+
1154
+#if !TARGET_OS_OSX
1155
+- (void)setPullToRefreshEnabled:(BOOL)pullToRefreshEnabled
1156
+{
1157
+    _pullToRefreshEnabled = pullToRefreshEnabled;
1158
+    
1159
+    if (pullToRefreshEnabled) {
1160
+        [self addPullToRefreshControl];
1161
+    } else {
1162
+        [_refreshControl removeFromSuperview];
1163
+    }
1164
+
1165
+    [self setBounces:_bounces];
1166
+}
1167
+#endif // !TARGET_OS_OSX
1168
+
1146 1169
 - (void)stopLoading
1147 1170
 {
1148 1171
   [_webView stopLoading];
@@ -1152,11 +1175,11 @@ static NSDictionary* customCertificatesForHost;
1152 1175
 - (void)setBounces:(BOOL)bounces
1153 1176
 {
1154 1177
   _bounces = bounces;
1155
-  _webView.scrollView.bounces = bounces;
1178
+    //For UIRefreshControl to work correctly, the bounces should always be true
1179
+  _webView.scrollView.bounces = _pullToRefreshEnabled || bounces;
1156 1180
 }
1157 1181
 #endif // !TARGET_OS_OSX
1158 1182
 
1159
-
1160 1183
 - (void)setInjectedJavaScript:(NSString *)source {
1161 1184
   _injectedJavaScript = source;
1162 1185
 
@@ -1361,4 +1384,3 @@ static NSDictionary* customCertificatesForHost;
1361 1384
 }
1362 1385
 
1363 1386
 @end
1364
-

+ 20
- 0
apple/RNCWebViewManager.m Voir le fichier

@@ -14,6 +14,16 @@
14 14
 @interface RNCWebViewManager () <RNCWebViewDelegate>
15 15
 @end
16 16
 
17
+@implementation RCTConvert (WKWebView)
18
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
19
+RCT_ENUM_CONVERTER(WKContentMode, (@{
20
+    @"recommended": @(WKContentModeRecommended),
21
+    @"mobile": @(WKContentModeMobile),
22
+    @"desktop": @(WKContentModeDesktop),
23
+}), WKContentModeRecommended, integerValue)
24
+#endif
25
+@end
26
+
17 27
 @implementation RNCWebViewManager
18 28
 {
19 29
   NSConditionLock *_shouldStartLoadLock;
@@ -47,6 +57,7 @@ RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptBeforeContentLoaded, NSString)
47 57
 RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptForMainFrameOnly, BOOL)
48 58
 RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptBeforeContentLoadedForMainFrameOnly, BOOL)
49 59
 RCT_EXPORT_VIEW_PROPERTY(javaScriptEnabled, BOOL)
60
+RCT_EXPORT_VIEW_PROPERTY(javaScriptCanOpenWindowsAutomatically, BOOL)
50 61
 RCT_EXPORT_VIEW_PROPERTY(allowFileAccessFromFileURLs, BOOL)
51 62
 RCT_EXPORT_VIEW_PROPERTY(allowsInlineMediaPlayback, BOOL)
52 63
 RCT_EXPORT_VIEW_PROPERTY(mediaPlaybackRequiresUserAction, BOOL)
@@ -55,6 +66,7 @@ RCT_EXPORT_VIEW_PROPERTY(dataDetectorTypes, WKDataDetectorTypes)
55 66
 #endif
56 67
 RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets)
57 68
 RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL)
69
+RCT_EXPORT_VIEW_PROPERTY(autoManageStatusBarEnabled, BOOL)
58 70
 RCT_EXPORT_VIEW_PROPERTY(hideKeyboardAccessoryView, BOOL)
59 71
 RCT_EXPORT_VIEW_PROPERTY(allowsBackForwardNavigationGestures, BOOL)
60 72
 RCT_EXPORT_VIEW_PROPERTY(incognito, BOOL)
@@ -69,6 +81,10 @@ RCT_EXPORT_VIEW_PROPERTY(allowingReadAccessToURL, NSString)
69 81
 RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior)
70 82
 #endif
71 83
 
84
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
85
+RCT_EXPORT_VIEW_PROPERTY(contentMode, WKContentMode)
86
+#endif
87
+
72 88
 /**
73 89
  * Expose methods to enable messaging the webview.
74 90
  */
@@ -88,6 +104,10 @@ RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)m
88 104
   }];
89 105
 }
90 106
 
107
+RCT_CUSTOM_VIEW_PROPERTY(pullToRefreshEnabled, BOOL, RNCWebView) {
108
+    view.pullToRefreshEnabled = json == nil ? false : [RCTConvert BOOL: json];
109
+}
110
+
91 111
 RCT_CUSTOM_VIEW_PROPERTY(bounces, BOOL, RNCWebView) {
92 112
   view.bounces = json == nil ? true : [RCTConvert BOOL: json];
93 113
 }

+ 1
- 1
docs/Custom-Android.md Voir le fichier

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

+ 3
- 1
docs/Debugging.md Voir le fichier

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

+ 26
- 16
docs/Guide.md Voir le fichier

@@ -55,6 +55,10 @@ class MyWeb extends Component {
55 55
 
56 56
 ### Loading local HTML files
57 57
 
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
+
58 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
@@ -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;
@@ -235,11 +241,12 @@ is used to determine if an HTTP response should be a download. On iOS 12 or olde
235 241
 trigger calls to `onFileDownload`.
236 242
 
237 243
 Example:
244
+
238 245
 ```javascript
239
-  onFileDownload = ({ nativeEvent }) => {
240
-    const { downloadUrl } = nativeEvent;
241
-    // --> Your download code goes here <--
242
-  }
246
+onFileDownload = ({ nativeEvent }) => {
247
+  const { downloadUrl } = nativeEvent;
248
+  // --> Your download code goes here <--
249
+};
243 250
 ```
244 251
 
245 252
 To be able to save images to the gallery you need to specify this permission in your `ios/[project]/Info.plist` file:
@@ -252,13 +259,13 @@ To be able to save images to the gallery you need to specify this permission in
252 259
 ##### Android
253 260
 
254 261
 On Android, integration with the DownloadManager is built-in.
255
-All you have to do to support downloads is add these permissions in AndroidManifest.xml:
262
+Add this permisison in AndroidManifest.xml (only required if your app supports Android versions lower than 10):
256 263
 
257 264
 ```xml
258 265
 <manifest ...>
259 266
   ......
260 267
 
261
-  <!-- this is required to save files on Android  -->
268
+  <!-- this is required to save files on Android versions lower than 10 -->
262 269
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
263 270
 
264 271
   ......
@@ -298,6 +305,7 @@ export default class App extends Component {
298 305
             uri:
299 306
               'https://github.com/react-native-community/react-native-webview',
300 307
           }}
308
+          onMessage={(event) => {}}
301 309
           injectedJavaScript={runFirst}
302 310
         />
303 311
       </View>
@@ -306,9 +314,9 @@ export default class App extends Component {
306 314
 }
307 315
 ```
308 316
 
309
-This runs the JavaScript in the `runFirst` string once the page is loaded. In this case, you can see that both the body style was changed to red and the alert showed up after 2 seconds.
317
+This runs the JavaScript in the `runFirst` string once the page is loaded. In this case, you can see that both the body style was changed to red and the alert showed up after 2 seconds. An `onMessage` event is required as well to inject the JavaScript code into the WebView.
310 318
 
311
-By setting `injectedJavaScriptForMainFrameOnly: false`, the JavaScript injection will occur on all frames (not just the top frame) if supported for the given platform.
319
+By setting `injectedJavaScriptForMainFrameOnly: false`, the JavaScript injection will occur on all frames (not just the main frame) if supported for the given platform. For example, if a page contains an iframe, the javascript will be injected into that iframe as well with this set to `false`. (Note this is not supported on Android.) There is also `injectedJavaScriptBeforeContentLoadedForMainFrameOnly` for injecting prior to content loading. Read more about this in the [Reference](./Reference.md#injectedjavascriptformainframeonly).
312 320
 
313 321
 <img alt="screenshot of Github repo" width="200" src="https://user-images.githubusercontent.com/1479215/53609254-e5dc9c00-3b7a-11e9-9118-bc4e520ce6ca.png" />
314 322
 
@@ -349,10 +357,11 @@ export default class App extends Component {
349 357
 
350 358
 This runs the JavaScript in the `runFirst` string before the page is loaded. In this case, the value of `window.isNativeApp` will be set to true before the web code executes.
351 359
 
352
-By setting `injectedJavaScriptBeforeContentLoadedForMainFrameOnly: false`, the JavaScript injection will occur on all frames (not just the top frame) if supported for the given platform. Howver, although support for `injectedJavaScriptBeforeContentLoadedForMainFrameOnly: false` has been implemented for iOS and macOS, [it is not clear](https://github.com/react-native-community/react-native-webview/pull/1119#issuecomment-600275750) that it is actually possible to inject JS into iframes at this point in the page lifecycle, and so relying on the expected behaviour of this prop when set to `false` is not recommended.
360
+By setting `injectedJavaScriptBeforeContentLoadedForMainFrameOnly: false`, the JavaScript injection will occur on all frames (not just the top frame) if supported for the given platform. However, although support for `injectedJavaScriptBeforeContentLoadedForMainFrameOnly: false` has been implemented for iOS and macOS, [it is not clear](https://github.com/react-native-community/react-native-webview/pull/1119#issuecomment-600275750) that it is actually possible to inject JS into iframes at this point in the page lifecycle, and so relying on the expected behaviour of this prop when set to `false` is not recommended.
353 361
 
354 362
 > On iOS, ~~`injectedJavaScriptBeforeContentLoaded` runs a method on WebView called `evaluateJavaScript:completionHandler:`~~ – this is no longer true as of version `8.2.0`. Instead, we use a `WKUserScript` with injection time `WKUserScriptInjectionTimeAtDocumentStart`. As a consequence, `injectedJavaScriptBeforeContentLoaded` no longer returns an evaluation value nor logs a warning to the console. In the unlikely event that your app depended upon this behaviour, please see migration steps [here](https://github.com/react-native-community/react-native-webview/pull/1119#issuecomment-574919464) to retain equivalent behaviour.
355 363
 > On Android, `injectedJavaScript` runs a method on the Android WebView called `evaluateJavascriptWithFallback`
364
+> Note on Android Compatibility: For applications targeting `Build.VERSION_CODES.N` or later, JavaScript state from an empty WebView is no longer persisted across navigations like `loadUrl(java.lang.String)`. For example, global variables and functions defined before calling `loadUrl(java.lang.String)` will not exist in the loaded page. Applications should use the Android Native API `addJavascriptInterface(Object, String)` instead to persist JavaScript objects across navigations.
356 365
 
357 366
 #### The `injectJavaScript` method
358 367
 
@@ -377,7 +386,7 @@ export default class App extends Component {
377 386
     return (
378 387
       <View style={{ flex: 1 }}>
379 388
         <WebView
380
-          ref={r => (this.webref = r)}
389
+          ref={(r) => (this.webref = r)}
381 390
           source={{
382 391
             uri:
383 392
               'https://github.com/react-native-community/react-native-webview',
@@ -430,7 +439,7 @@ export default class App extends Component {
430 439
       <View style={{ flex: 1 }}>
431 440
         <WebView
432 441
           source={{ html }}
433
-          onMessage={event => {
442
+          onMessage={(event) => {
434 443
             alert(event.nativeEvent.data);
435 444
           }}
436 445
         />
@@ -466,7 +475,7 @@ This will set the header on the first load, but not on subsequent page navigatio
466 475
 In order to work around this, you can track the current URL, intercept new page loads, and navigate to them yourself ([original credit for this technique to Chirag Shah from Big Binary](https://blog.bigbinary.com/2016/07/26/passing-request-headers-on-each-webview-request-in-react-native.html)):
467 476
 
468 477
 ```jsx
469
-const CustomHeaderWebView = props => {
478
+const CustomHeaderWebView = (props) => {
470 479
   const { uri, onLoadStart, ...restProps } = props;
471 480
   const [currentURI, setURI] = useState(props.source.uri);
472 481
   const newSource = { ...props.source, uri: currentURI };
@@ -475,7 +484,7 @@ const CustomHeaderWebView = props => {
475 484
     <WebView
476 485
       {...restProps}
477 486
       source={newSource}
478
-      onShouldStartLoadWithRequest={request => {
487
+      onShouldStartLoadWithRequest={(request) => {
479 488
         // If we're loading the current URI, allow it to load
480 489
         if (request.url === currentURI) return true;
481 490
         // We're loading a new URL -- change state first
@@ -500,7 +509,7 @@ const CustomHeaderWebView = props => {
500 509
 
501 510
 You can set cookies on the React Native side using the [@react-native-community/cookies](https://github.com/react-native-community/cookies) package.
502 511
 
503
-When you do, you'll likely want to enable the [sharedCookiesEnabled](Reference#sharedCookiesEnabled) prop as well.
512
+When you do, you'll likely want to enable the [sharedCookiesEnabled](Reference.md#sharedCookiesEnabled) prop as well.
504 513
 
505 514
 ```jsx
506 515
 const App = () => {
@@ -534,6 +543,7 @@ const App = () => {
534 543
 Note that these cookies will only be sent on the first request unless you use the technique above for [setting custom headers on each page load](#Setting-Custom-Headers).
535 544
 
536 545
 ### Hardware Silence Switch
546
+
537 547
 There are some inconsistencies in how the hardware silence switch is handled between embedded `audio` and `video` elements and between iOS and Android platforms.
538 548
 
539 549
 Audio on `iOS` will be muted when the hardware silence switch is in the on position, unless the `ignoreSilentHardwareSwitch` parameter is set to true.

+ 5
- 1
docs/README.portuguese.md Voir le fichier

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

+ 255
- 137
docs/Reference.md
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 7
- 0
example/android/app/src/main/java/com/example/MainApplication.java Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

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

+ 28
- 27
example/examples/Injection.tsx Voir le fichier

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

+ 3
- 3
example/ios/Podfile Voir le fichier

@@ -31,9 +31,9 @@ target 'example' do
31 31
   pod 'React-jsi', :path => '../../node_modules/react-native/ReactCommon/jsi'
32 32
   pod 'React-jsiexecutor', :path => '../../node_modules/react-native/ReactCommon/jsiexecutor'
33 33
   pod 'React-jsinspector', :path => '../../node_modules/react-native/ReactCommon/jsinspector'
34
-  pod 'ReactCommon/jscallinvoker', :path => "../../node_modules/react-native/ReactCommon"
34
+  pod 'ReactCommon/callinvoker', :path => "../../node_modules/react-native/ReactCommon"
35 35
   pod 'ReactCommon/turbomodule/core', :path => "../../node_modules/react-native/ReactCommon"
36
-  pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga'
36
+  pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga', :modular_headers => true
37 37
 
38 38
   pod 'DoubleConversion', :podspec => '../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
39 39
   pod 'glog', :podspec => '../../node_modules/react-native/third-party-podspecs/glog.podspec'
@@ -49,7 +49,7 @@ 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 Voir le fichier

@@ -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 (9.3.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: 60d883f994e96a560756c14592552e02a06d604d
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: c2e136f84288494fa269d79892a8a1cf7acd7c71
366
+PODFILE CHECKSUM: 767ae042fafc1aba97b301c58c340ff6f992aa27
343 367
 
344
-COCOAPODS: 1.8.4
368
+COCOAPODS: 1.9.1

+ 11
- 7
example/ios/example.xcodeproj/project.pbxproj Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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
- 42
example/macos/Podfile Voir le fichier

@@ -1,42 +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
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

+ 8
- 8
example/macos/example-iOS/AppDelegate.h Voir le fichier

@@ -1,8 +1,8 @@
1
-#import <React/RCTBridgeDelegate.h>
2
-#import <UIKit/UIKit.h>
3
-
4
-@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
5
-
6
-@property (nonatomic, strong) UIWindow *window;
7
-
8
-@end
1
+#import <React/RCTBridgeDelegate.h>
2
+#import <UIKit/UIKit.h>
3
+
4
+@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
5
+
6
+@property (nonatomic, strong) UIWindow *window;
7
+
8
+@end

+ 35
- 35
example/macos/example-iOS/AppDelegate.m Voir le fichier

@@ -1,35 +1,35 @@
1
-#import "AppDelegate.h"
2
-
3
-#import <React/RCTBridge.h>
4
-#import <React/RCTBundleURLProvider.h>
5
-#import <React/RCTRootView.h>
6
-
7
-@implementation AppDelegate
8
-
9
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
10
-{
11
-  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
12
-  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
13
-                                                   moduleName:@"example"
14
-                                            initialProperties:nil];
15
-
16
-  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
17
-
18
-  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
19
-  UIViewController *rootViewController = [UIViewController new];
20
-  rootViewController.view = rootView;
21
-  self.window.rootViewController = rootViewController;
22
-  [self.window makeKeyAndVisible];
23
-  return YES;
24
-}
25
-
26
-- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
27
-{
28
-#if DEBUG
29
-  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"example/index" fallbackResource:nil];
30
-#else
31
-  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
32
-#endif
33
-}
34
-
35
-@end
1
+#import "AppDelegate.h"
2
+
3
+#import <React/RCTBridge.h>
4
+#import <React/RCTBundleURLProvider.h>
5
+#import <React/RCTRootView.h>
6
+
7
+@implementation AppDelegate
8
+
9
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
10
+{
11
+  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
12
+  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
13
+                                                   moduleName:@"example"
14
+                                            initialProperties:nil];
15
+
16
+  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
17
+
18
+  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
19
+  UIViewController *rootViewController = [UIViewController new];
20
+  rootViewController.view = rootView;
21
+  self.window.rootViewController = rootViewController;
22
+  [self.window makeKeyAndVisible];
23
+  return YES;
24
+}
25
+
26
+- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
27
+{
28
+#if DEBUG
29
+  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"example/index" fallbackResource:nil];
30
+#else
31
+  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
32
+#endif
33
+}
34
+
35
+@end

+ 42
- 42
example/macos/example-iOS/Base.lproj/LaunchScreen.xib Voir le fichier

@@ -1,42 +1,42 @@
1
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
3
-    <dependencies>
4
-        <deployment identifier="iOS"/>
5
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
6
-        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
7
-    </dependencies>
8
-    <objects>
9
-        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
10
-        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
11
-        <view contentMode="scaleToFill" id="iN0-l3-epB">
12
-            <rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
13
-            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
14
-            <subviews>
15
-                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
16
-                    <rect key="frame" x="20" y="439" width="441" height="21"/>
17
-                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
18
-                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
19
-                    <nil key="highlightedColor"/>
20
-                </label>
21
-                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="example" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
22
-                    <rect key="frame" x="20" y="140" width="441" height="43"/>
23
-                    <fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
24
-                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
25
-                    <nil key="highlightedColor"/>
26
-                </label>
27
-            </subviews>
28
-            <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
29
-            <constraints>
30
-                <constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
31
-                <constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
32
-                <constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
33
-                <constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
34
-                <constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
35
-                <constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
36
-            </constraints>
37
-            <nil key="simulatedStatusBarMetrics"/>
38
-            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
39
-            <point key="canvasLocation" x="548" y="455"/>
40
-        </view>
41
-    </objects>
42
-</document>
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
3
+    <dependencies>
4
+        <deployment identifier="iOS"/>
5
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
6
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
7
+    </dependencies>
8
+    <objects>
9
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
10
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
11
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
12
+            <rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
13
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
14
+            <subviews>
15
+                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
16
+                    <rect key="frame" x="20" y="439" width="441" height="21"/>
17
+                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
18
+                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
19
+                    <nil key="highlightedColor"/>
20
+                </label>
21
+                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="example" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
22
+                    <rect key="frame" x="20" y="140" width="441" height="43"/>
23
+                    <fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
24
+                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
25
+                    <nil key="highlightedColor"/>
26
+                </label>
27
+            </subviews>
28
+            <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
29
+            <constraints>
30
+                <constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
31
+                <constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
32
+                <constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
33
+                <constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
34
+                <constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
35
+                <constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
36
+            </constraints>
37
+            <nil key="simulatedStatusBarMetrics"/>
38
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
39
+            <point key="canvasLocation" x="548" y="455"/>
40
+        </view>
41
+    </objects>
42
+</document>

+ 37
- 37
example/macos/example-iOS/Images.xcassets/AppIcon.appiconset/Contents.json Voir le fichier

@@ -1,38 +1,38 @@
1
-{
2
-  "images" : [
3
-    {
4
-      "idiom" : "iphone",
5
-      "size" : "29x29",
6
-      "scale" : "2x"
7
-    },
8
-    {
9
-      "idiom" : "iphone",
10
-      "size" : "29x29",
11
-      "scale" : "3x"
12
-    },
13
-    {
14
-      "idiom" : "iphone",
15
-      "size" : "40x40",
16
-      "scale" : "2x"
17
-    },
18
-    {
19
-      "idiom" : "iphone",
20
-      "size" : "40x40",
21
-      "scale" : "3x"
22
-    },
23
-    {
24
-      "idiom" : "iphone",
25
-      "size" : "60x60",
26
-      "scale" : "2x"
27
-    },
28
-    {
29
-      "idiom" : "iphone",
30
-      "size" : "60x60",
31
-      "scale" : "3x"
32
-    }
33
-  ],
34
-  "info" : {
35
-    "version" : 1,
36
-    "author" : "xcode"
37
-  }
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "iphone",
5
+      "size" : "29x29",
6
+      "scale" : "2x"
7
+    },
8
+    {
9
+      "idiom" : "iphone",
10
+      "size" : "29x29",
11
+      "scale" : "3x"
12
+    },
13
+    {
14
+      "idiom" : "iphone",
15
+      "size" : "40x40",
16
+      "scale" : "2x"
17
+    },
18
+    {
19
+      "idiom" : "iphone",
20
+      "size" : "40x40",
21
+      "scale" : "3x"
22
+    },
23
+    {
24
+      "idiom" : "iphone",
25
+      "size" : "60x60",
26
+      "scale" : "2x"
27
+    },
28
+    {
29
+      "idiom" : "iphone",
30
+      "size" : "60x60",
31
+      "scale" : "3x"
32
+    }
33
+  ],
34
+  "info" : {
35
+    "version" : 1,
36
+    "author" : "xcode"
37
+  }
38 38
 }

+ 6
- 6
example/macos/example-iOS/Images.xcassets/Contents.json Voir le fichier

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

+ 57
- 57
example/macos/example-iOS/Info.plist Voir le fichier

@@ -1,57 +1,57 @@
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>CFBundleDevelopmentRegion</key>
6
-	<string>en</string>
7
-	<key>CFBundleDisplayName</key>
8
-	<string>$(PRODUCT_NAME)</string>
9
-	<key>CFBundleExecutable</key>
10
-	<string>$(EXECUTABLE_NAME)</string>
11
-	<key>CFBundleIdentifier</key>
12
-	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13
-	<key>CFBundleInfoDictionaryVersion</key>
14
-	<string>6.0</string>
15
-	<key>CFBundleName</key>
16
-	<string>$(PRODUCT_NAME)</string>
17
-	<key>CFBundlePackageType</key>
18
-	<string>APPL</string>
19
-	<key>CFBundleShortVersionString</key>
20
-	<string>1.0</string>
21
-	<key>CFBundleSignature</key>
22
-	<string>????</string>
23
-	<key>CFBundleVersion</key>
24
-	<string>1</string>
25
-	<key>LSRequiresIPhoneOS</key>
26
-	<true/>
27
-	<key>NSAppTransportSecurity</key>
28
-	<dict>
29
-		<key>NSAllowsArbitraryLoads</key>
30
-		<true/>
31
-		<key>NSExceptionDomains</key>
32
-		<dict>
33
-			<key>localhost</key>
34
-			<dict>
35
-				<key>NSExceptionAllowsInsecureHTTPLoads</key>
36
-				<true/>
37
-			</dict>
38
-		</dict>
39
-	</dict>
40
-	<key>NSLocationWhenInUseUsageDescription</key>
41
-	<string></string>
42
-	<key>UILaunchStoryboardName</key>
43
-	<string>LaunchScreen</string>
44
-	<key>UIRequiredDeviceCapabilities</key>
45
-	<array>
46
-		<string>armv7</string>
47
-	</array>
48
-	<key>UISupportedInterfaceOrientations</key>
49
-	<array>
50
-		<string>UIInterfaceOrientationPortrait</string>
51
-		<string>UIInterfaceOrientationLandscapeLeft</string>
52
-		<string>UIInterfaceOrientationLandscapeRight</string>
53
-	</array>
54
-	<key>UIViewControllerBasedStatusBarAppearance</key>
55
-	<false/>
56
-</dict>
57
-</plist>
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>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleDisplayName</key>
8
+	<string>$(PRODUCT_NAME)</string>
9
+	<key>CFBundleExecutable</key>
10
+	<string>$(EXECUTABLE_NAME)</string>
11
+	<key>CFBundleIdentifier</key>
12
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13
+	<key>CFBundleInfoDictionaryVersion</key>
14
+	<string>6.0</string>
15
+	<key>CFBundleName</key>
16
+	<string>$(PRODUCT_NAME)</string>
17
+	<key>CFBundlePackageType</key>
18
+	<string>APPL</string>
19
+	<key>CFBundleShortVersionString</key>
20
+	<string>1.0</string>
21
+	<key>CFBundleSignature</key>
22
+	<string>????</string>
23
+	<key>CFBundleVersion</key>
24
+	<string>1</string>
25
+	<key>LSRequiresIPhoneOS</key>
26
+	<true/>
27
+	<key>NSAppTransportSecurity</key>
28
+	<dict>
29
+		<key>NSAllowsArbitraryLoads</key>
30
+		<true/>
31
+		<key>NSExceptionDomains</key>
32
+		<dict>
33
+			<key>localhost</key>
34
+			<dict>
35
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
36
+				<true/>
37
+			</dict>
38
+		</dict>
39
+	</dict>
40
+	<key>NSLocationWhenInUseUsageDescription</key>
41
+	<string></string>
42
+	<key>UILaunchStoryboardName</key>
43
+	<string>LaunchScreen</string>
44
+	<key>UIRequiredDeviceCapabilities</key>
45
+	<array>
46
+		<string>armv7</string>
47
+	</array>
48
+	<key>UISupportedInterfaceOrientations</key>
49
+	<array>
50
+		<string>UIInterfaceOrientationPortrait</string>
51
+		<string>UIInterfaceOrientationLandscapeLeft</string>
52
+		<string>UIInterfaceOrientationLandscapeRight</string>
53
+	</array>
54
+	<key>UIViewControllerBasedStatusBarAppearance</key>
55
+	<false/>
56
+</dict>
57
+</plist>

+ 9
- 9
example/macos/example-iOS/main.m Voir le fichier

@@ -1,9 +1,9 @@
1
-#import <UIKit/UIKit.h>
2
-
3
-#import "AppDelegate.h"
4
-
5
-int main(int argc, char * argv[]) {
6
-  @autoreleasepool {
7
-    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8
-  }
9
-}
1
+#import <UIKit/UIKit.h>
2
+
3
+#import "AppDelegate.h"
4
+
5
+int main(int argc, char * argv[]) {
6
+  @autoreleasepool {
7
+    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8
+  }
9
+}

+ 9
- 9
example/macos/example-macOS/AppDelegate.h Voir le fichier

@@ -1,9 +1,9 @@
1
-#import <Cocoa/Cocoa.h>
2
-
3
-@class RCTBridge;
4
-
5
-@interface AppDelegate : NSObject <NSApplicationDelegate>
6
-
7
-@property (nonatomic, readonly) RCTBridge *bridge;
8
-
9
-@end
1
+#import <Cocoa/Cocoa.h>
2
+
3
+@class RCTBridge;
4
+
5
+@interface AppDelegate : NSObject <NSApplicationDelegate>
6
+
7
+@property (nonatomic, readonly) RCTBridge *bridge;
8
+
9
+@end

+ 32
- 32
example/macos/example-macOS/AppDelegate.m Voir le fichier

@@ -1,32 +1,32 @@
1
-#import "AppDelegate.h"
2
-
3
-#import <React/RCTBridge.h>
4
-#import <React/RCTBundleURLProvider.h>
5
-
6
-@interface AppDelegate () <RCTBridgeDelegate>
7
-
8
-@end
9
-
10
-@implementation AppDelegate
11
-
12
-- (void)awakeFromNib {
13
-  [super awakeFromNib];
14
-
15
-  _bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil];
16
-}
17
-
18
-- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
19
-  // Insert code here to initialize your application
20
-}
21
-
22
-- (void)applicationWillTerminate:(NSNotification *)aNotification {
23
-  // Insert code here to tear down your application
24
-}
25
-
26
-#pragma mark - RCTBridgeDelegate Methods
27
-
28
-- (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge {
29
-  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"example/index" fallbackResource:@"main"]; // .jsbundle;
30
-}
31
-
32
-@end
1
+#import "AppDelegate.h"
2
+
3
+#import <React/RCTBridge.h>
4
+#import <React/RCTBundleURLProvider.h>
5
+
6
+@interface AppDelegate () <RCTBridgeDelegate>
7
+
8
+@end
9
+
10
+@implementation AppDelegate
11
+
12
+- (void)awakeFromNib {
13
+  [super awakeFromNib];
14
+
15
+  _bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil];
16
+}
17
+
18
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
19
+  // Insert code here to initialize your application
20
+}
21
+
22
+- (void)applicationWillTerminate:(NSNotification *)aNotification {
23
+  // Insert code here to tear down your application
24
+}
25
+
26
+#pragma mark - RCTBridgeDelegate Methods
27
+
28
+- (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge {
29
+  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"example/index" fallbackResource:@"main"]; // .jsbundle;
30
+}
31
+
32
+@end

+ 58
- 58
example/macos/example-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json Voir le fichier

@@ -1,58 +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
-}
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
- 6
example/macos/example-macOS/Assets.xcassets/Contents.json Voir le fichier

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

+ 717
- 717
example/macos/example-macOS/Base.lproj/Main.storyboard
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 47
- 47
example/macos/example-macOS/Info.plist Voir le fichier

@@ -1,47 +1,47 @@
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>CFBundleDevelopmentRegion</key>
6
-	<string>$(DEVELOPMENT_LANGUAGE)</string>
7
-	<key>CFBundleExecutable</key>
8
-	<string>$(EXECUTABLE_NAME)</string>
9
-	<key>CFBundleIconFile</key>
10
-	<string></string>
11
-	<key>CFBundleIdentifier</key>
12
-	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13
-	<key>CFBundleInfoDictionaryVersion</key>
14
-	<string>6.0</string>
15
-	<key>CFBundleName</key>
16
-	<string>$(PRODUCT_NAME)</string>
17
-	<key>CFBundlePackageType</key>
18
-	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
19
-	<key>CFBundleShortVersionString</key>
20
-	<string>1.0</string>
21
-	<key>CFBundleVersion</key>
22
-	<string>1</string>
23
-	<key>LSMinimumSystemVersion</key>
24
-	<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
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>NSMainStoryboardFile</key>
39
-	<string>Main</string>
40
-	<key>NSPrincipalClass</key>
41
-	<string>NSApplication</string>
42
-	<key>NSSupportsAutomaticTermination</key>
43
-	<true/>
44
-	<key>NSSupportsSuddenTermination</key>
45
-	<true/>
46
-</dict>
47
-</plist>
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>CFBundleDevelopmentRegion</key>
6
+	<string>$(DEVELOPMENT_LANGUAGE)</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIconFile</key>
10
+	<string></string>
11
+	<key>CFBundleIdentifier</key>
12
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13
+	<key>CFBundleInfoDictionaryVersion</key>
14
+	<string>6.0</string>
15
+	<key>CFBundleName</key>
16
+	<string>$(PRODUCT_NAME)</string>
17
+	<key>CFBundlePackageType</key>
18
+	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
19
+	<key>CFBundleShortVersionString</key>
20
+	<string>1.0</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+	<key>LSMinimumSystemVersion</key>
24
+	<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
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>NSMainStoryboardFile</key>
39
+	<string>Main</string>
40
+	<key>NSPrincipalClass</key>
41
+	<string>NSApplication</string>
42
+	<key>NSSupportsAutomaticTermination</key>
43
+	<true/>
44
+	<key>NSSupportsSuddenTermination</key>
45
+	<true/>
46
+</dict>
47
+</plist>

+ 5
- 5
example/macos/example-macOS/ViewController.h Voir le fichier

@@ -1,5 +1,5 @@
1
-#import <Cocoa/Cocoa.h>
2
-
3
-@interface ViewController : NSViewController
4
-
5
-@end
1
+#import <Cocoa/Cocoa.h>
2
+
3
+@interface ViewController : NSViewController
4
+
5
+@end

+ 22
- 22
example/macos/example-macOS/ViewController.m Voir le fichier

@@ -1,22 +1,22 @@
1
-#import "ViewController.h"
2
-#import "AppDelegate.h"
3
-
4
-#import <React/RCTRootView.h>
5
-
6
-@implementation ViewController
7
-
8
-- (void)viewDidLoad {
9
-  [super viewDidLoad];
10
-
11
-  RCTBridge *bridge = [((AppDelegate *)[NSApp delegate])bridge];
12
-  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"example" initialProperties:nil];
13
-
14
-  NSView *view = [self view];
15
-
16
-  [view addSubview:rootView];
17
-  [rootView setBackgroundColor:[NSColor windowBackgroundColor]];
18
-  [rootView setFrame:[view bounds]];
19
-  [rootView setAutoresizingMask:(NSViewMinXMargin | NSViewMinXMargin | NSViewMinYMargin | NSViewMaxYMargin | NSViewWidthSizable | NSViewHeightSizable)];
20
-}
21
-
22
-@end
1
+#import "ViewController.h"
2
+#import "AppDelegate.h"
3
+
4
+#import <React/RCTRootView.h>
5
+
6
+@implementation ViewController
7
+
8
+- (void)viewDidLoad {
9
+  [super viewDidLoad];
10
+
11
+  RCTBridge *bridge = [((AppDelegate *)[NSApp delegate])bridge];
12
+  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"example" initialProperties:nil];
13
+
14
+  NSView *view = [self view];
15
+
16
+  [view addSubview:rootView];
17
+  [rootView setBackgroundColor:[NSColor windowBackgroundColor]];
18
+  [rootView setFrame:[view bounds]];
19
+  [rootView setAutoresizingMask:(NSViewMinXMargin | NSViewMinXMargin | NSViewMinYMargin | NSViewMaxYMargin | NSViewWidthSizable | NSViewHeightSizable)];
20
+}
21
+
22
+@end

+ 12
- 12
example/macos/example-macOS/example.entitlements Voir le fichier

@@ -1,12 +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>
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>

+ 5
- 5
example/macos/example-macOS/main.m Voir le fichier

@@ -1,5 +1,5 @@
1
-#import <Cocoa/Cocoa.h>
2
-
3
-int main(int argc, const char *argv[]) {
4
-  return NSApplicationMain(argc, argv);
5
-}
1
+#import <Cocoa/Cocoa.h>
2
+
3
+int main(int argc, const char *argv[]) {
4
+  return NSApplicationMain(argc, argv);
5
+}

+ 78
- 78
example/macos/example.xcodeproj/xcshareddata/xcschemes/example-iOS.xcscheme Voir le fichier

@@ -1,78 +1,78 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<Scheme
3
-   LastUpgradeVersion = "1140"
4
-   version = "1.3">
5
-   <BuildAction
6
-      parallelizeBuildables = "YES"
7
-      buildImplicitDependencies = "YES">
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 = "13B07F861A680F5B00A75B9A"
18
-               BuildableName = "example.app"
19
-               BlueprintName = "example-iOS"
20
-               ReferencedContainer = "container:example.xcodeproj">
21
-            </BuildableReference>
22
-         </BuildActionEntry>
23
-      </BuildActionEntries>
24
-   </BuildAction>
25
-   <TestAction
26
-      buildConfiguration = "Debug"
27
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
-      shouldUseLaunchSchemeArgsEnv = "YES">
30
-      <Testables>
31
-      </Testables>
32
-   </TestAction>
33
-   <LaunchAction
34
-      buildConfiguration = "Debug"
35
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
-      launchStyle = "0"
38
-      useCustomWorkingDirectory = "NO"
39
-      ignoresPersistentStateOnLaunch = "NO"
40
-      debugDocumentVersioning = "YES"
41
-      debugServiceExtension = "internal"
42
-      allowLocationSimulation = "YES">
43
-      <BuildableProductRunnable
44
-         runnableDebuggingMode = "0">
45
-         <BuildableReference
46
-            BuildableIdentifier = "primary"
47
-            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
48
-            BuildableName = "example.app"
49
-            BlueprintName = "example-iOS"
50
-            ReferencedContainer = "container:example.xcodeproj">
51
-         </BuildableReference>
52
-      </BuildableProductRunnable>
53
-   </LaunchAction>
54
-   <ProfileAction
55
-      buildConfiguration = "Release"
56
-      shouldUseLaunchSchemeArgsEnv = "YES"
57
-      savedToolIdentifier = ""
58
-      useCustomWorkingDirectory = "NO"
59
-      debugDocumentVersioning = "YES">
60
-      <BuildableProductRunnable
61
-         runnableDebuggingMode = "0">
62
-         <BuildableReference
63
-            BuildableIdentifier = "primary"
64
-            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
65
-            BuildableName = "example.app"
66
-            BlueprintName = "example-iOS"
67
-            ReferencedContainer = "container:example.xcodeproj">
68
-         </BuildableReference>
69
-      </BuildableProductRunnable>
70
-   </ProfileAction>
71
-   <AnalyzeAction
72
-      buildConfiguration = "Debug">
73
-   </AnalyzeAction>
74
-   <ArchiveAction
75
-      buildConfiguration = "Release"
76
-      revealArchiveInOrganizer = "YES">
77
-   </ArchiveAction>
78
-</Scheme>
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "1140"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "YES"
7
+      buildImplicitDependencies = "YES">
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 = "13B07F861A680F5B00A75B9A"
18
+               BuildableName = "example.app"
19
+               BlueprintName = "example-iOS"
20
+               ReferencedContainer = "container:example.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+      </BuildActionEntries>
24
+   </BuildAction>
25
+   <TestAction
26
+      buildConfiguration = "Debug"
27
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
+      shouldUseLaunchSchemeArgsEnv = "YES">
30
+      <Testables>
31
+      </Testables>
32
+   </TestAction>
33
+   <LaunchAction
34
+      buildConfiguration = "Debug"
35
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
+      launchStyle = "0"
38
+      useCustomWorkingDirectory = "NO"
39
+      ignoresPersistentStateOnLaunch = "NO"
40
+      debugDocumentVersioning = "YES"
41
+      debugServiceExtension = "internal"
42
+      allowLocationSimulation = "YES">
43
+      <BuildableProductRunnable
44
+         runnableDebuggingMode = "0">
45
+         <BuildableReference
46
+            BuildableIdentifier = "primary"
47
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
48
+            BuildableName = "example.app"
49
+            BlueprintName = "example-iOS"
50
+            ReferencedContainer = "container:example.xcodeproj">
51
+         </BuildableReference>
52
+      </BuildableProductRunnable>
53
+   </LaunchAction>
54
+   <ProfileAction
55
+      buildConfiguration = "Release"
56
+      shouldUseLaunchSchemeArgsEnv = "YES"
57
+      savedToolIdentifier = ""
58
+      useCustomWorkingDirectory = "NO"
59
+      debugDocumentVersioning = "YES">
60
+      <BuildableProductRunnable
61
+         runnableDebuggingMode = "0">
62
+         <BuildableReference
63
+            BuildableIdentifier = "primary"
64
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
65
+            BuildableName = "example.app"
66
+            BlueprintName = "example-iOS"
67
+            ReferencedContainer = "container:example.xcodeproj">
68
+         </BuildableReference>
69
+      </BuildableProductRunnable>
70
+   </ProfileAction>
71
+   <AnalyzeAction
72
+      buildConfiguration = "Debug">
73
+   </AnalyzeAction>
74
+   <ArchiveAction
75
+      buildConfiguration = "Release"
76
+      revealArchiveInOrganizer = "YES">
77
+   </ArchiveAction>
78
+</Scheme>

+ 78
- 78
example/macos/example.xcodeproj/xcshareddata/xcschemes/example-macOS.xcscheme Voir le fichier

@@ -1,78 +1,78 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<Scheme
3
-   LastUpgradeVersion = "1140"
4
-   version = "1.3">
5
-   <BuildAction
6
-      parallelizeBuildables = "YES"
7
-      buildImplicitDependencies = "YES">
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 = "514201482437B4B30078DB4F"
18
-               BuildableName = "example.app"
19
-               BlueprintName = "example-macOS"
20
-               ReferencedContainer = "container:example.xcodeproj">
21
-            </BuildableReference>
22
-         </BuildActionEntry>
23
-      </BuildActionEntries>
24
-   </BuildAction>
25
-   <TestAction
26
-      buildConfiguration = "Debug"
27
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
-      shouldUseLaunchSchemeArgsEnv = "YES">
30
-      <Testables>
31
-      </Testables>
32
-   </TestAction>
33
-   <LaunchAction
34
-      buildConfiguration = "Debug"
35
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
-      launchStyle = "0"
38
-      useCustomWorkingDirectory = "NO"
39
-      ignoresPersistentStateOnLaunch = "NO"
40
-      debugDocumentVersioning = "YES"
41
-      debugServiceExtension = "internal"
42
-      allowLocationSimulation = "YES">
43
-      <BuildableProductRunnable
44
-         runnableDebuggingMode = "0">
45
-         <BuildableReference
46
-            BuildableIdentifier = "primary"
47
-            BlueprintIdentifier = "514201482437B4B30078DB4F"
48
-            BuildableName = "example.app"
49
-            BlueprintName = "example-macOS"
50
-            ReferencedContainer = "container:example.xcodeproj">
51
-         </BuildableReference>
52
-      </BuildableProductRunnable>
53
-   </LaunchAction>
54
-   <ProfileAction
55
-      buildConfiguration = "Release"
56
-      shouldUseLaunchSchemeArgsEnv = "YES"
57
-      savedToolIdentifier = ""
58
-      useCustomWorkingDirectory = "NO"
59
-      debugDocumentVersioning = "YES">
60
-      <BuildableProductRunnable
61
-         runnableDebuggingMode = "0">
62
-         <BuildableReference
63
-            BuildableIdentifier = "primary"
64
-            BlueprintIdentifier = "514201482437B4B30078DB4F"
65
-            BuildableName = "example.app"
66
-            BlueprintName = "example-macOS"
67
-            ReferencedContainer = "container:example.xcodeproj">
68
-         </BuildableReference>
69
-      </BuildableProductRunnable>
70
-   </ProfileAction>
71
-   <AnalyzeAction
72
-      buildConfiguration = "Debug">
73
-   </AnalyzeAction>
74
-   <ArchiveAction
75
-      buildConfiguration = "Release"
76
-      revealArchiveInOrganizer = "YES">
77
-   </ArchiveAction>
78
-</Scheme>
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "1140"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "YES"
7
+      buildImplicitDependencies = "YES">
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 = "514201482437B4B30078DB4F"
18
+               BuildableName = "example.app"
19
+               BlueprintName = "example-macOS"
20
+               ReferencedContainer = "container:example.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+      </BuildActionEntries>
24
+   </BuildAction>
25
+   <TestAction
26
+      buildConfiguration = "Debug"
27
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
+      shouldUseLaunchSchemeArgsEnv = "YES">
30
+      <Testables>
31
+      </Testables>
32
+   </TestAction>
33
+   <LaunchAction
34
+      buildConfiguration = "Debug"
35
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
+      launchStyle = "0"
38
+      useCustomWorkingDirectory = "NO"
39
+      ignoresPersistentStateOnLaunch = "NO"
40
+      debugDocumentVersioning = "YES"
41
+      debugServiceExtension = "internal"
42
+      allowLocationSimulation = "YES">
43
+      <BuildableProductRunnable
44
+         runnableDebuggingMode = "0">
45
+         <BuildableReference
46
+            BuildableIdentifier = "primary"
47
+            BlueprintIdentifier = "514201482437B4B30078DB4F"
48
+            BuildableName = "example.app"
49
+            BlueprintName = "example-macOS"
50
+            ReferencedContainer = "container:example.xcodeproj">
51
+         </BuildableReference>
52
+      </BuildableProductRunnable>
53
+   </LaunchAction>
54
+   <ProfileAction
55
+      buildConfiguration = "Release"
56
+      shouldUseLaunchSchemeArgsEnv = "YES"
57
+      savedToolIdentifier = ""
58
+      useCustomWorkingDirectory = "NO"
59
+      debugDocumentVersioning = "YES">
60
+      <BuildableProductRunnable
61
+         runnableDebuggingMode = "0">
62
+         <BuildableReference
63
+            BuildableIdentifier = "primary"
64
+            BlueprintIdentifier = "514201482437B4B30078DB4F"
65
+            BuildableName = "example.app"
66
+            BlueprintName = "example-macOS"
67
+            ReferencedContainer = "container:example.xcodeproj">
68
+         </BuildableReference>
69
+      </BuildableProductRunnable>
70
+   </ProfileAction>
71
+   <AnalyzeAction
72
+      buildConfiguration = "Debug">
73
+   </AnalyzeAction>
74
+   <ArchiveAction
75
+      buildConfiguration = "Release"
76
+      revealArchiveInOrganizer = "YES">
77
+   </ArchiveAction>
78
+</Scheme>

+ 1
- 0
example/windows/WebViewWindows.sln Voir le fichier

@@ -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 Voir le fichier

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

+ 3
- 4
example/windows/WebViewWindows/WebViewWindows.vcxproj Voir le fichier

@@ -161,12 +161,11 @@
161 161
   </ItemGroup>
162 162
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
163 163
   <PropertyGroup>
164
-    <BundleCommand>
165
-      cd $(SolutionDir)..\..
166
-      npx react-native bundle --platform windows --entry-file example/index.js --bundle-output example/windows/WebViewWindows/Bundle/index.windows.bundle --assets-dest example/windows/WebViewWindows/Bundle --use-react-native-windows
167
-    </BundleCommand>
164
+    <BundleEntryFile>example/index.js</BundleEntryFile>
165
+    <BundlerExtraArgs>--use-react-native-windows</BundlerExtraArgs>
168 166
   </PropertyGroup>
169 167
   <Import Project="..\..\..\node_modules\react-native-windows\PropertySheets\Bundle.Cpp.targets" />
168
+  <Import Project="..\..\..\node_modules\react-native-windows\PropertySheets\Bundle.props" />
170 169
   <ImportGroup Label="ExtensionTargets">
171 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')" />
172 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')" />

+ 24
- 24
example/windows/WebViewWindows/pch.h Voir le fichier

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

+ 24
- 1
index.d.ts Voir le fichier

@@ -6,7 +6,7 @@ export { FileDownload, WebViewMessageEvent, WebViewNavigation } from "./lib/WebV
6 6
 
7 7
 export type WebViewProps = IOSWebViewProps & AndroidWebViewProps;
8 8
 
9
-declare class WebView extends Component<WebViewProps> {
9
+declare class WebView<P = {}> extends Component<WebViewProps & P> {
10 10
     /**
11 11
      * Go back one page in the webview's history.
12 12
      */
@@ -41,6 +41,29 @@ declare class WebView extends Component<WebViewProps> {
41 41
      * Focuses on WebView redered page.
42 42
      */
43 43
     requestFocus: () => void;
44
+    
45
+     /**
46
+     * Posts a message to WebView.
47
+     */
48
+    postMessage: (message: string) => void;
49
+    
50
+     /**
51
+     * (Android only)
52
+     * Removes the autocomplete popup from the currently focused form field, if present.
53
+     */
54
+    clearFormData: () => void;
55
+
56
+     /**
57
+     * (Android only)
58
+     * Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used.
59
+     */
60
+    clearCache: (clear: boolean) => void;
61
+
62
+     /**
63
+     * (Android only)
64
+     * Tells this WebView to clear its internal back/forward list.
65
+     */
66
+    clearHistory: () => void;
44 67
 }
45 68
 
46 69
 export {WebView};

+ 2
- 0
metro.config.windows.js Voir le fichier

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

+ 90
- 91
package.json Voir le fichier

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

+ 1
- 1
react-native-webview.podspec Voir le fichier

@@ -15,5 +15,5 @@ Pod::Spec.new do |s|
15 15
   s.source       = { :git => "https://github.com/react-native-community/react-native-webview.git", :tag => "v#{s.version}" }
16 16
   s.source_files  = "apple/**/*.{h,m}"
17 17
 
18
-  s.dependency 'React'
18
+  s.dependency 'React-Core'
19 19
 end

+ 14
- 0
react-native.config.js Voir le fichier

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

+ 17
- 3
src/WebView.android.tsx Voir le fichier

@@ -21,6 +21,7 @@ import {
21 21
   defaultRenderLoading,
22 22
 } from './WebViewShared';
23 23
 import {
24
+  WebViewRenderProcessGoneEvent,
24 25
   WebViewErrorEvent,
25 26
   WebViewHttpErrorEvent,
26 27
   WebViewMessageEvent,
@@ -60,6 +61,7 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
60 61
     saveFormDataDisabled: false,
61 62
     cacheEnabled: true,
62 63
     androidHardwareAccelerationDisabled: false,
64
+    androidLayerType: 'none',
63 65
     originWhitelist: defaultOriginWhitelist,
64 66
   };
65 67
 
@@ -75,6 +77,7 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
75 77
     lastErrorEvent: null,
76 78
   };
77 79
 
80
+  onShouldStartLoadWithRequest: ReturnType<typeof createOnShouldStartLoadWithRequest> | null = null;
78 81
 
79 82
   webViewRef = React.createRef<NativeWebViewAndroid>();
80 83
 
@@ -228,6 +231,13 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
228 231
     }
229 232
   }
230 233
 
234
+  onRenderProcessGone = (event: WebViewRenderProcessGoneEvent) => {
235
+    const { onRenderProcessGone } = this.props;
236
+    if (onRenderProcessGone) {
237
+      onRenderProcessGone(event);
238
+    }
239
+  }
240
+
231 241
   onLoadingFinish = (event: WebViewNavigationEvent) => {
232 242
     const { onLoad, onLoadEnd } = this.props;
233 243
     const { nativeEvent: { url } } = event;
@@ -271,8 +281,11 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
271 281
   onShouldStartLoadWithRequestCallback = (
272 282
     shouldStart: boolean,
273 283
     url: string,
284
+    lockIdentifier?: number,
274 285
   ) => {
275
-    if (shouldStart) {
286
+    if (lockIdentifier) {
287
+      NativeModules.RNCWebView.onShouldStartLoadWithRequestCallback(shouldStart, lockIdentifier);
288
+    } else if (shouldStart) {
276 289
       UIManager.dispatchViewManagerCommand(
277 290
         this.getWebViewHandle(),
278 291
         this.getCommands().loadUrl,
@@ -329,7 +342,7 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
329 342
     const NativeWebView
330 343
       = (nativeConfig.component as typeof NativeWebViewAndroid) || RNCWebView;
331 344
 
332
-    const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
345
+    this.onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
333 346
       this.onShouldStartLoadWithRequestCallback,
334 347
       // casting cause it's in the default props
335 348
       originWhitelist as readonly string[],
@@ -347,8 +360,9 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
347 360
         onLoadingProgress={this.onLoadingProgress}
348 361
         onLoadingStart={this.onLoadingStart}
349 362
         onHttpError={this.onHttpError}
363
+        onRenderProcessGone={this.onRenderProcessGone}
350 364
         onMessage={this.onMessage}
351
-        onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
365
+        onShouldStartLoadWithRequest={this.onShouldStartLoadWithRequest}
352 366
         ref={this.webViewRef}
353 367
         // TODO: find a better way to type this.
354 368
         source={resolveAssetSource(source as ImageSourcePropType)}

+ 18
- 3
src/WebView.tsx Voir le fichier

@@ -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 Voir le fichier

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

+ 2
- 2
src/WebViewShared.tsx Voir le fichier

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

+ 97
- 10
src/WebViewTypes.ts Voir le fichier

@@ -113,6 +113,10 @@ export interface WebViewNavigation extends WebViewNativeEvent {
113 113
   mainDocumentURL?: string;
114 114
 }
115 115
 
116
+export interface ShouldStartLoadRequest extends WebViewNavigation {
117
+  isTopFrame: boolean;
118
+}
119
+
116 120
 export interface FileDownload {
117 121
   downloadUrl: string;
118 122
 }
@@ -137,6 +141,10 @@ export interface WebViewHttpError extends WebViewNativeEvent {
137 141
   statusCode: number;
138 142
 }
139 143
 
144
+export interface WebViewRenderProcessGoneDetail {
145
+  didCrash: boolean;
146
+}
147
+
140 148
 export type WebViewEvent = NativeSyntheticEvent<WebViewNativeEvent>;
141 149
 
142 150
 export type WebViewProgressEvent = NativeSyntheticEvent<
@@ -145,6 +153,8 @@ export type WebViewProgressEvent = NativeSyntheticEvent<
145 153
 
146 154
 export type WebViewNavigationEvent = NativeSyntheticEvent<WebViewNavigation>;
147 155
 
156
+export type ShouldStartLoadRequestEvent = NativeSyntheticEvent<ShouldStartLoadRequest>;
157
+
148 158
 export type FileDownloadEvent = NativeSyntheticEvent<FileDownload>;
149 159
 
150 160
 export type WebViewMessageEvent = NativeSyntheticEvent<WebViewMessage>;
@@ -155,6 +165,8 @@ export type WebViewTerminatedEvent = NativeSyntheticEvent<WebViewNativeEvent>;
155 165
 
156 166
 export type WebViewHttpErrorEvent = NativeSyntheticEvent<WebViewHttpError>;
157 167
 
168
+export type WebViewRenderProcessGoneEvent = NativeSyntheticEvent<WebViewRenderProcessGoneDetail>;
169
+
158 170
 export type DataDetectorTypes =
159 171
   | 'phoneNumber'
160 172
   | 'link'
@@ -170,6 +182,8 @@ export type OverScrollModeType = 'always' | 'content' | 'never';
170 182
 
171 183
 export type CacheMode = 'LOAD_DEFAULT' | 'LOAD_CACHE_ONLY' | 'LOAD_CACHE_ELSE_NETWORK' | 'LOAD_NO_CACHE';
172 184
 
185
+export type AndroidLayerType = 'none' | 'software' | 'hardware';
186
+
173 187
 export interface WebViewSourceUri {
174 188
   /**
175 189
    * The URI to load in the `WebView`. Can be a local or remote file.
@@ -232,7 +246,7 @@ export interface WebViewNativeConfig {
232 246
 }
233 247
 
234 248
 export type OnShouldStartLoadWithRequest = (
235
-  event: WebViewNavigation,
249
+  event: ShouldStartLoadRequest,
236 250
 ) => boolean;
237 251
 
238 252
 export interface CommonNativeWebViewProps extends ViewProps {
@@ -240,6 +254,9 @@ export interface CommonNativeWebViewProps extends ViewProps {
240 254
   incognito?: boolean;
241 255
   injectedJavaScript?: string;
242 256
   injectedJavaScriptBeforeContentLoaded?: string;
257
+  injectedJavaScriptForMainFrameOnly?: boolean;
258
+  injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
259
+  javaScriptCanOpenWindowsAutomatically?: boolean;
243 260
   mediaPlaybackRequiresUserAction?: boolean;
244 261
   messagingEnabled: boolean;
245 262
   onScroll?: (event: NativeScrollEvent) => void;
@@ -249,7 +266,7 @@ export interface CommonNativeWebViewProps extends ViewProps {
249 266
   onLoadingStart: (event: WebViewNavigationEvent) => void;
250 267
   onHttpError: (event: WebViewHttpErrorEvent) => void;
251 268
   onMessage: (event: WebViewMessageEvent) => void;
252
-  onShouldStartLoadWithRequest: (event: WebViewNavigationEvent) => void;
269
+  onShouldStartLoadWithRequest: (event: ShouldStartLoadRequestEvent) => void;
253 270
   showsHorizontalScrollIndicator?: boolean;
254 271
   showsVerticalScrollIndicator?: boolean;
255 272
   // TODO: find a better way to type this.
@@ -257,7 +274,7 @@ export interface CommonNativeWebViewProps extends ViewProps {
257 274
   source: any;
258 275
   userAgent?: string;
259 276
   /**
260
-   * Append to the existing user-agent. Overriden if `userAgent` is set.
277
+   * Append to the existing user-agent. Overridden if `userAgent` is set.
261 278
    */
262 279
   applicationNameForUserAgent?: string;
263 280
 }
@@ -269,11 +286,13 @@ export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
269 286
   allowFileAccessFromFileURLs?: boolean;
270 287
   allowUniversalAccessFromFileURLs?: boolean;
271 288
   androidHardwareAccelerationDisabled?: boolean;
289
+  androidLayerType?: AndroidLayerType;
272 290
   domStorageEnabled?: boolean;
273 291
   geolocationEnabled?: boolean;
274 292
   javaScriptEnabled?: boolean;
275 293
   mixedContentMode?: 'never' | 'always' | 'compatibility';
276 294
   onContentSizeChange?: (event: WebViewEvent) => void;
295
+  onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void;
277 296
   overScrollMode?: OverScrollModeType;
278 297
   saveFormDataDisabled?: boolean;
279 298
   textZoom?: number;
@@ -282,12 +301,9 @@ export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
282 301
   readonly urlPrefixesForDefaultIntent?: string[];
283 302
 }
284 303
 
285
-export enum ContentInsetAdjustmentBehavior {
286
-  automatic = 'automatic',
287
-  scrollableAxes = 'scrollableAxes',
288
-  never = 'never',
289
-  always = 'always'
290
-};
304
+export declare type ContentInsetAdjustmentBehavior = 'automatic' | 'scrollableAxes' | 'never' | 'always';
305
+
306
+export declare type ContentMode = 'recommended' | 'mobile' | 'desktop';
291 307
 
292 308
 export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
293 309
   allowingReadAccessToURL?: string;
@@ -295,9 +311,11 @@ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
295 311
   allowsInlineMediaPlayback?: boolean;
296 312
   allowsLinkPreview?: boolean;
297 313
   automaticallyAdjustContentInsets?: boolean;
314
+  autoManageStatusBarEnabled?: boolean;
298 315
   bounces?: boolean;
299 316
   contentInset?: ContentInsetProp;
300 317
   contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior;
318
+  contentMode?: ContentMode;
301 319
   readonly dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[];
302 320
   decelerationRate?: number;
303 321
   directionalLockEnabled?: boolean;
@@ -395,6 +413,18 @@ export interface IOSWebViewProps extends WebViewSharedProps {
395 413
    */
396 414
   contentInset?: ContentInsetProp;
397 415
 
416
+  /**
417
+   * Defaults to `recommended`, which loads mobile content on iPhone
418
+   * and iPad Mini but desktop content on other iPads.
419
+   *
420
+   * Possible values are:
421
+   * - `'recommended'`
422
+   * - `'mobile'`
423
+   * - `'desktop'`
424
+   * @platform ios
425
+   */
426
+  contentMode?: ContentMode;
427
+
398 428
   /**
399 429
    * Determines the types of data converted to clickable URLs in the web view's content.
400 430
    * By default only phone numbers are detected.
@@ -469,6 +499,13 @@ export interface IOSWebViewProps extends WebViewSharedProps {
469 499
    */
470 500
   sharedCookiesEnabled?: boolean;
471 501
 
502
+  /**
503
+   * Set true if StatusBar should be light when user watch video fullscreen.
504
+   * The default value is `true`.
505
+   * @platform ios
506
+   */
507
+  autoManageStatusBarEnabled?: boolean;
508
+
472 509
   /**
473 510
    * A Boolean value that determines whether scrolling is disabled in a particular direction.
474 511
    * The default value is `true`.
@@ -520,6 +557,15 @@ export interface IOSWebViewProps extends WebViewSharedProps {
520 557
   */
521 558
   injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
522 559
 
560
+  /**
561
+   * Boolean value that determines whether a pull to refresh gesture is
562
+   * available in the `WebView`. The default value is `false`.
563
+   * If `true`, sets `bounces` automatically to `true`
564
+   * @platform ios
565
+   *
566
+  */
567
+  pullToRefreshEnabled?: boolean;
568
+
523 569
   /**
524 570
    * Function that is invoked when the client needs to download a file.
525 571
    *
@@ -680,6 +726,12 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
680 726
   onNavigationStateChange?: (event: WebViewNavigation) => void;
681 727
   onContentSizeChange?: (event: WebViewEvent) => void;
682 728
 
729
+  /**
730
+   * Function that is invoked when the `WebView` process crashes or is killed by the OS.
731
+   * Works only on Android (minimum API level 26).
732
+   */
733
+  onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void;
734
+
683 735
   /**
684 736
    * https://developer.android.com/reference/android/webkit/WebSettings.html#setCacheMode(int)
685 737
    * Set the cacheMode. Possible values are:
@@ -718,7 +770,7 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
718 770
    */
719 771
   geolocationEnabled?: boolean;
720 772
 
721
-  
773
+
722 774
   /**
723 775
    * Boolean that sets whether JavaScript running in the context of a file
724 776
    * scheme URL should be allowed to access content from other file scheme URLs.
@@ -763,6 +815,18 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
763 815
    */
764 816
   androidHardwareAccelerationDisabled?: boolean;
765 817
 
818
+    /**
819
+   * https://developer.android.com/reference/android/webkit/WebView#setLayerType(int,%20android.graphics.Paint)
820
+   * Sets the layerType. Possible values are:
821
+   *
822
+   * - `'none'` (default)
823
+   * - `'software'`
824
+   * - `'hardware'`
825
+   *
826
+   * @platform android
827
+   */
828
+  androidLayerType?: AndroidLayerType;
829
+
766 830
   /**
767 831
    * Boolean value to enable third party cookies in the `WebView`. Used on
768 832
    * Android Lollipop and above only as third party cookies are enabled by
@@ -821,6 +885,12 @@ export interface WebViewSharedProps extends ViewProps {
821 885
    */
822 886
   javaScriptEnabled?: boolean;
823 887
 
888
+  /**
889
+   * A Boolean value indicating whether JavaScript can open windows without user interaction.
890
+   * The default value is `false`.
891
+   */
892
+  javaScriptCanOpenWindowsAutomatically?: boolean;
893
+
824 894
   /**
825 895
    * Stylesheet object to set the style of the container view.
826 896
    */
@@ -908,6 +978,18 @@ export interface WebViewSharedProps extends ViewProps {
908 978
    */
909 979
   injectedJavaScriptBeforeContentLoaded?: string;
910 980
 
981
+  /**
982
+   * If `true` (default; mandatory for Android), loads the `injectedJavaScript` only into the main frame.
983
+   * If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
984
+   */
985
+  injectedJavaScriptForMainFrameOnly?: boolean;
986
+
987
+  /**
988
+   * If `true` (default; mandatory for Android), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
989
+   * If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
990
+   */
991
+  injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
992
+
911 993
   /**
912 994
    * Boolean value that determines whether a horizontal scroll indicator is
913 995
    * shown in the `WebView`. The default value is `true`.
@@ -952,4 +1034,9 @@ export interface WebViewSharedProps extends ViewProps {
952 1034
    * Should caching be enabled. Default is true.
953 1035
    */
954 1036
   cacheEnabled?: boolean;
1037
+
1038
+  /**
1039
+   * Append to the existing user-agent. Overridden if `userAgent` is set.
1040
+   */
1041
+  applicationNameForUserAgent?: string;
955 1042
 }

+ 204
- 204
windows/ReactNativeWebView.sln Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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) && 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
-        m_reactContext.DispatchEvent(
133
-            m_webView,
134
-            L"topMessage",
135
-            [&](winrt::Microsoft::ReactNative::IJSValueWriter const& eventDataWriter) noexcept {
136
-                eventDataWriter.WriteObjectBegin();
137
-                {
138
-                    WriteProperty(eventDataWriter, L"data", winrt::to_string(args.Value()));
139
-                }
140
-                eventDataWriter.WriteObjectEnd();
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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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
-                        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
-    IMapView<hstring, int64_t> ReactWebViewManager::Commands() noexcept {
105
-        auto commands = winrt::single_threaded_map<hstring, int64_t>();
106
-        commands.Insert(L"goForward", static_cast<int32_t>(WebViewCommands::GoForward));
107
-        commands.Insert(L"goBack", static_cast<int32_t>(WebViewCommands::GoBack));
108
-        commands.Insert(L"reload", static_cast<int32_t>(WebViewCommands::Reload));
109
-        commands.Insert(L"stopLoading", static_cast<int32_t>(WebViewCommands::StopLoading));
110
-        commands.Insert(L"injectJavaScript", static_cast<int32_t>(WebViewCommands::InjectJavaScript));
111
-        return commands.GetView();
112
-    }
113
-
114
-    void ReactWebViewManager::DispatchCommand(
115
-        FrameworkElement const& view,
116
-        int64_t commandId,
117
-        winrt::IJSValueReader const& commandArgsReader) noexcept {
118
-        auto commandArgs = JSValue::ReadArrayFrom(commandArgsReader);
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", { winrt::to_hstring(commandArgs[0].AsString()) });
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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

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

+ 13
- 13
windows/ReactNativeWebView/pch.h Voir le fichier

@@ -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
- 14445
yarn.lock
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier