Quellcode durchsuchen

Merge branch 'master' into add_prop_autoManageStatusBar

Thibault Malbranche vor 4 Jahren
Ursprung
Commit
2962eb2a4c
Es ist kein Benutzerkonto mit dieser Commiter-Email verbunden
57 geänderte Dateien mit 16876 neuen und 16480 gelöschten Zeilen
  1. 12
    0
      .gitattributes
  2. 5
    11
      .github/workflows/windows-ci.yml
  3. 128
    26
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
  4. 45
    1
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java
  5. 26
    0
      android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt
  6. 2
    0
      android/src/main/java/com/reactnativecommunity/webview/events/TopShouldStartLoadWithRequestEvent.kt
  7. 8
    0
      apple/RNCWebView.h
  8. 48
    38
      apple/RNCWebView.m
  9. 18
    0
      apple/RNCWebViewManager.m
  10. 3
    1
      docs/Debugging.md
  11. 3
    2
      docs/Guide.md
  12. 161
    80
      docs/Reference.md
  13. 100
    100
      example/android/gradlew.bat
  14. 42
    42
      example/macos/Podfile
  15. 8
    8
      example/macos/example-iOS/AppDelegate.h
  16. 35
    35
      example/macos/example-iOS/AppDelegate.m
  17. 42
    42
      example/macos/example-iOS/Base.lproj/LaunchScreen.xib
  18. 37
    37
      example/macos/example-iOS/Images.xcassets/AppIcon.appiconset/Contents.json
  19. 6
    6
      example/macos/example-iOS/Images.xcassets/Contents.json
  20. 57
    57
      example/macos/example-iOS/Info.plist
  21. 9
    9
      example/macos/example-iOS/main.m
  22. 9
    9
      example/macos/example-macOS/AppDelegate.h
  23. 32
    32
      example/macos/example-macOS/AppDelegate.m
  24. 58
    58
      example/macos/example-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json
  25. 6
    6
      example/macos/example-macOS/Assets.xcassets/Contents.json
  26. 717
    717
      example/macos/example-macOS/Base.lproj/Main.storyboard
  27. 47
    47
      example/macos/example-macOS/Info.plist
  28. 5
    5
      example/macos/example-macOS/ViewController.h
  29. 22
    22
      example/macos/example-macOS/ViewController.m
  30. 12
    12
      example/macos/example-macOS/example.entitlements
  31. 5
    5
      example/macos/example-macOS/main.m
  32. 78
    78
      example/macos/example.xcodeproj/xcshareddata/xcschemes/example-iOS.xcscheme
  33. 78
    78
      example/macos/example.xcodeproj/xcshareddata/xcschemes/example-macOS.xcscheme
  34. 24
    24
      example/windows/WebViewWindows/pch.h
  35. 24
    1
      index.d.ts
  36. 2
    0
      metro.config.windows.js
  37. 90
    91
      package.json
  38. 17
    3
      src/WebView.android.tsx
  39. 266
    266
      src/WebView.windows.tsx
  40. 2
    2
      src/WebViewShared.tsx
  41. 68
    10
      src/WebViewTypes.ts
  42. 204
    204
      windows/ReactNativeWebView.sln
  43. 15
    15
      windows/ReactNativeWebView/PropertySheet.props
  44. 3
    3
      windows/ReactNativeWebView/ReactNativeWebView.def
  45. 32
    32
      windows/ReactNativeWebView/ReactNativeWebView.filters
  46. 159
    159
      windows/ReactNativeWebView/ReactNativeWebView.vcxproj
  47. 17
    17
      windows/ReactNativeWebView/ReactPackageProvider.cpp
  48. 20
    20
      windows/ReactNativeWebView/ReactPackageProvider.h
  49. 7
    7
      windows/ReactNativeWebView/ReactPackageProvider.idl
  50. 147
    147
      windows/ReactNativeWebView/ReactWebView.cpp
  51. 36
    36
      windows/ReactNativeWebView/ReactWebView.h
  52. 7
    7
      windows/ReactNativeWebView/ReactWebView.idl
  53. 144
    144
      windows/ReactNativeWebView/ReactWebViewManager.cpp
  54. 3
    3
      windows/ReactNativeWebView/packages.config
  55. 1
    1
      windows/ReactNativeWebView/pch.cpp
  56. 13
    13
      windows/ReactNativeWebView/pch.h
  57. 13711
    13711
      yarn.lock

+ 12
- 0
.gitattributes Datei anzeigen

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 Datei anzeigen

15
       with:
15
       with:
16
         node-version: '12.9.1'
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
     - name: Setup MSBuild
18
     - name: Setup MSBuild
23
       uses: microsoft/setup-msbuild@v1.0.0
19
       uses: microsoft/setup-msbuild@v1.0.0
24
       with:
20
       with:
25
         vs-version: 16.5
21
         vs-version: 16.5
26
-       
27
-    - name: Setup NuGet
28
-      uses: NuGet/setup-nuget@v1.0.2
29
 
22
 
30
     - name: Check node modules cache
23
     - name: Check node modules cache
31
       uses: actions/cache@v1
24
       uses: actions/cache@v1
45
       run: |
38
       run: |
46
         yarn build
39
         yarn build
47
         yarn tsc
40
         yarn tsc
48
- 
49
-    - name: NuGet restore
50
-      run: nuget restore example\windows\WebViewWindows.sln
51
 
41
 
52
     - name: Build x64 release
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
     - name: Deploy
49
     - name: Deploy
56
       shell: powershell
50
       shell: powershell
57
       run: |
51
       run: |

+ 128
- 26
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java Datei anzeigen

4
 import android.annotation.TargetApi;
4
 import android.annotation.TargetApi;
5
 import android.app.DownloadManager;
5
 import android.app.DownloadManager;
6
 import android.content.Context;
6
 import android.content.Context;
7
-import android.content.Intent;
8
 import android.content.pm.ActivityInfo;
7
 import android.content.pm.ActivityInfo;
9
 import android.content.pm.PackageManager;
8
 import android.content.pm.PackageManager;
10
 import android.graphics.Bitmap;
9
 import android.graphics.Bitmap;
14
 import android.net.Uri;
13
 import android.net.Uri;
15
 import android.os.Build;
14
 import android.os.Build;
16
 import android.os.Environment;
15
 import android.os.Environment;
17
-import androidx.annotation.RequiresApi;
18
-import androidx.core.content.ContextCompat;
16
+import android.os.SystemClock;
19
 import android.text.TextUtils;
17
 import android.text.TextUtils;
18
+import android.util.Log;
20
 import android.view.Gravity;
19
 import android.view.Gravity;
21
 import android.view.View;
20
 import android.view.View;
22
 import android.view.ViewGroup;
21
 import android.view.ViewGroup;
27
 import android.webkit.DownloadListener;
26
 import android.webkit.DownloadListener;
28
 import android.webkit.GeolocationPermissions;
27
 import android.webkit.GeolocationPermissions;
29
 import android.webkit.JavascriptInterface;
28
 import android.webkit.JavascriptInterface;
29
+import android.webkit.RenderProcessGoneDetail;
30
 import android.webkit.SslErrorHandler;
30
 import android.webkit.SslErrorHandler;
31
 import android.webkit.PermissionRequest;
31
 import android.webkit.PermissionRequest;
32
 import android.webkit.URLUtil;
32
 import android.webkit.URLUtil;
39
 import android.webkit.WebViewClient;
39
 import android.webkit.WebViewClient;
40
 import android.widget.FrameLayout;
40
 import android.widget.FrameLayout;
41
 
41
 
42
+import androidx.annotation.Nullable;
43
+import androidx.annotation.RequiresApi;
44
+import androidx.core.content.ContextCompat;
45
+import androidx.core.util.Pair;
46
+
47
+import com.facebook.common.logging.FLog;
42
 import com.facebook.react.views.scroll.ScrollEvent;
48
 import com.facebook.react.views.scroll.ScrollEvent;
43
 import com.facebook.react.views.scroll.ScrollEventType;
49
 import com.facebook.react.views.scroll.ScrollEventType;
44
 import com.facebook.react.views.scroll.OnScrollDispatchHelper;
50
 import com.facebook.react.views.scroll.OnScrollDispatchHelper;
62
 import com.facebook.react.uimanager.events.ContentSizeChangeEvent;
68
 import com.facebook.react.uimanager.events.ContentSizeChangeEvent;
63
 import com.facebook.react.uimanager.events.Event;
69
 import com.facebook.react.uimanager.events.Event;
64
 import com.facebook.react.uimanager.events.EventDispatcher;
70
 import com.facebook.react.uimanager.events.EventDispatcher;
71
+import com.reactnativecommunity.webview.RNCWebViewModule.ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState;
65
 import com.reactnativecommunity.webview.events.TopLoadingErrorEvent;
72
 import com.reactnativecommunity.webview.events.TopLoadingErrorEvent;
66
 import com.reactnativecommunity.webview.events.TopHttpErrorEvent;
73
 import com.reactnativecommunity.webview.events.TopHttpErrorEvent;
67
 import com.reactnativecommunity.webview.events.TopLoadingFinishEvent;
74
 import com.reactnativecommunity.webview.events.TopLoadingFinishEvent;
69
 import com.reactnativecommunity.webview.events.TopLoadingStartEvent;
76
 import com.reactnativecommunity.webview.events.TopLoadingStartEvent;
70
 import com.reactnativecommunity.webview.events.TopMessageEvent;
77
 import com.reactnativecommunity.webview.events.TopMessageEvent;
71
 import com.reactnativecommunity.webview.events.TopShouldStartLoadWithRequestEvent;
78
 import com.reactnativecommunity.webview.events.TopShouldStartLoadWithRequestEvent;
79
+import com.reactnativecommunity.webview.events.TopRenderProcessGoneEvent;
72
 
80
 
73
 import org.json.JSONException;
81
 import org.json.JSONException;
74
 import org.json.JSONObject;
82
 import org.json.JSONObject;
81
 import java.util.HashMap;
89
 import java.util.HashMap;
82
 import java.util.Locale;
90
 import java.util.Locale;
83
 import java.util.Map;
91
 import java.util.Map;
84
-
85
-import javax.annotation.Nullable;
92
+import java.util.concurrent.atomic.AtomicReference;
86
 
93
 
87
 /**
94
 /**
88
  * Manages instances of {@link WebView}
95
  * Manages instances of {@link WebView}
110
  */
117
  */
111
 @ReactModule(name = RNCWebViewManager.REACT_CLASS)
118
 @ReactModule(name = RNCWebViewManager.REACT_CLASS)
112
 public class RNCWebViewManager extends SimpleViewManager<WebView> {
119
 public class RNCWebViewManager extends SimpleViewManager<WebView> {
120
+  private static final String TAG = "RNCWebViewManager";
113
 
121
 
114
   public static final int COMMAND_GO_BACK = 1;
122
   public static final int COMMAND_GO_BACK = 1;
115
   public static final int COMMAND_GO_FORWARD = 2;
123
   public static final int COMMAND_GO_FORWARD = 2;
133
   // Use `webView.loadUrl("about:blank")` to reliably reset the view
141
   // Use `webView.loadUrl("about:blank")` to reliably reset the view
134
   // state and release page resources (including any running JavaScript).
142
   // state and release page resources (including any running JavaScript).
135
   protected static final String BLANK_URL = "about:blank";
143
   protected static final String BLANK_URL = "about:blank";
144
+  protected static final int SHOULD_OVERRIDE_URL_LOADING_TIMEOUT = 250;
136
   protected WebViewConfig mWebViewConfig;
145
   protected WebViewConfig mWebViewConfig;
137
 
146
 
138
   protected RNCWebChromeClient mWebChromeClient = null;
147
   protected RNCWebChromeClient mWebChromeClient = null;
296
     }
305
     }
297
   }
306
   }
298
 
307
 
308
+  @ReactProp(name = "androidLayerType")
309
+  public void setLayerType(WebView view, String layerTypeString) {
310
+    int layerType = View.LAYER_TYPE_NONE;
311
+    switch (layerTypeString) {
312
+        case "hardware":
313
+          layerType = View.LAYER_TYPE_HARDWARE;
314
+          break;
315
+        case "software":
316
+          layerType = View.LAYER_TYPE_SOFTWARE;
317
+          break;
318
+    }
319
+    view.setLayerType(layerType, null);
320
+  }
321
+
322
+
299
   @ReactProp(name = "overScrollMode")
323
   @ReactProp(name = "overScrollMode")
300
   public void setOverScrollMode(WebView view, String overScrollModeString) {
324
   public void setOverScrollMode(WebView view, String overScrollModeString) {
301
     Integer overScrollMode;
325
     Integer overScrollMode;
429
 
453
 
430
   @ReactProp(name = "incognito")
454
   @ReactProp(name = "incognito")
431
   public void setIncognito(WebView view, boolean enabled) {
455
   public void setIncognito(WebView view, boolean enabled) {
456
+    // Don't do anything when incognito is disabled
457
+    if (!enabled) {
458
+      return;
459
+    }
460
+
432
     // Remove all previous cookies
461
     // Remove all previous cookies
433
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
462
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
434
       CookieManager.getInstance().removeAllCookies(null);
463
       CookieManager.getInstance().removeAllCookies(null);
438
 
467
 
439
     // Disable caching
468
     // Disable caching
440
     view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
469
     view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
441
-    view.getSettings().setAppCacheEnabled(!enabled);
470
+    view.getSettings().setAppCacheEnabled(false);
442
     view.clearHistory();
471
     view.clearHistory();
443
-    view.clearCache(enabled);
472
+    view.clearCache(true);
444
 
473
 
445
     // No form data or autofill enabled
474
     // No form data or autofill enabled
446
     view.clearFormData();
475
     view.clearFormData();
447
-    view.getSettings().setSavePassword(!enabled);
448
-    view.getSettings().setSaveFormData(!enabled);
476
+    view.getSettings().setSavePassword(false);
477
+    view.getSettings().setSaveFormData(false);
449
   }
478
   }
450
 
479
 
451
   @ReactProp(name = "source")
480
   @ReactProp(name = "source")
575
     export.put(TopShouldStartLoadWithRequestEvent.EVENT_NAME, MapBuilder.of("registrationName", "onShouldStartLoadWithRequest"));
604
     export.put(TopShouldStartLoadWithRequestEvent.EVENT_NAME, MapBuilder.of("registrationName", "onShouldStartLoadWithRequest"));
576
     export.put(ScrollEventType.getJSEventName(ScrollEventType.SCROLL), MapBuilder.of("registrationName", "onScroll"));
605
     export.put(ScrollEventType.getJSEventName(ScrollEventType.SCROLL), MapBuilder.of("registrationName", "onScroll"));
577
     export.put(TopHttpErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onHttpError"));
606
     export.put(TopHttpErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onHttpError"));
607
+    export.put(TopRenderProcessGoneEvent.EVENT_NAME, MapBuilder.of("registrationName", "onRenderProcessGone"));
578
     return export;
608
     return export;
579
   }
609
   }
580
 
610
 
771
       mLastLoadFailed = false;
801
       mLastLoadFailed = false;
772
 
802
 
773
       RNCWebView reactWebView = (RNCWebView) webView;
803
       RNCWebView reactWebView = (RNCWebView) webView;
774
-      reactWebView.callInjectedJavaScriptBeforeContentLoaded();       
804
+      reactWebView.callInjectedJavaScriptBeforeContentLoaded();
775
 
805
 
776
       dispatchEvent(
806
       dispatchEvent(
777
         webView,
807
         webView,
782
 
812
 
783
     @Override
813
     @Override
784
     public boolean shouldOverrideUrlLoading(WebView view, String url) {
814
     public boolean shouldOverrideUrlLoading(WebView view, String url) {
785
-      progressChangedFilter.setWaitingForCommandLoadUrl(true);
786
-      dispatchEvent(
787
-        view,
788
-        new TopShouldStartLoadWithRequestEvent(
789
-          view.getId(),
790
-          createWebViewEvent(view, url)));
791
-      return true;
792
-    }
815
+      final RNCWebView rncWebView = (RNCWebView) view;
816
+      final boolean isJsDebugging = ((ReactContext) view.getContext()).getJavaScriptContextHolder().get() == 0;
817
+
818
+      if (!isJsDebugging && rncWebView.mCatalystInstance != null) {
819
+        final Pair<Integer, AtomicReference<ShouldOverrideCallbackState>> lock = RNCWebViewModule.shouldOverrideUrlLoadingLock.getNewLock();
820
+        final int lockIdentifier = lock.first;
821
+        final AtomicReference<ShouldOverrideCallbackState> lockObject = lock.second;
822
+
823
+        final WritableMap event = createWebViewEvent(view, url);
824
+        event.putInt("lockIdentifier", lockIdentifier);
825
+        rncWebView.sendDirectMessage("onShouldStartLoadWithRequest", event);
826
+
827
+        try {
828
+          assert lockObject != null;
829
+          synchronized (lockObject) {
830
+            final long startTime = SystemClock.elapsedRealtime();
831
+            while (lockObject.get() == ShouldOverrideCallbackState.UNDECIDED) {
832
+              if (SystemClock.elapsedRealtime() - startTime > SHOULD_OVERRIDE_URL_LOADING_TIMEOUT) {
833
+                FLog.w(TAG, "Did not receive response to shouldOverrideUrlLoading in time, defaulting to allow loading.");
834
+                RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);
835
+                return false;
836
+              }
837
+              lockObject.wait(SHOULD_OVERRIDE_URL_LOADING_TIMEOUT);
838
+            }
839
+          }
840
+        } catch (InterruptedException e) {
841
+          FLog.e(TAG, "shouldOverrideUrlLoading was interrupted while waiting for result.", e);
842
+          RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);
843
+          return false;
844
+        }
793
 
845
 
846
+        final boolean shouldOverride = lockObject.get() == ShouldOverrideCallbackState.SHOULD_OVERRIDE;
847
+        RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);
848
+
849
+        return shouldOverride;
850
+      } else {
851
+        FLog.w(TAG, "Couldn't use blocking synchronous call for onShouldStartLoadWithRequest due to debugging or missing Catalyst instance, falling back to old event-and-load.");
852
+        progressChangedFilter.setWaitingForCommandLoadUrl(true);
853
+        dispatchEvent(
854
+          view,
855
+          new TopShouldStartLoadWithRequestEvent(
856
+            view.getId(),
857
+            createWebViewEvent(view, url)));
858
+        return true;
859
+      }
860
+    }
794
 
861
 
795
     @TargetApi(Build.VERSION_CODES.N)
862
     @TargetApi(Build.VERSION_CODES.N)
796
     @Override
863
     @Override
828
           case SslError.SSL_UNTRUSTED:
895
           case SslError.SSL_UNTRUSTED:
829
             description = "The certificate authority is not trusted";
896
             description = "The certificate authority is not trusted";
830
             break;
897
             break;
831
-          default: 
898
+          default:
832
             description = "Unknown SSL Error";
899
             description = "Unknown SSL Error";
833
             break;
900
             break;
834
         }
901
         }
835
-        
902
+
836
         description = descriptionPrefix + description;
903
         description = descriptionPrefix + description;
837
 
904
 
838
         this.onReceivedError(
905
         this.onReceivedError(
842
           failingUrl
909
           failingUrl
843
         );
910
         );
844
     }
911
     }
845
-    
912
+
846
     @Override
913
     @Override
847
     public void onReceivedError(
914
     public void onReceivedError(
848
       WebView webView,
915
       WebView webView,
899
       }
966
       }
900
     }
967
     }
901
 
968
 
969
+    @TargetApi(Build.VERSION_CODES.O)
970
+    @Override
971
+    public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail detail) {
972
+        // WebViewClient.onRenderProcessGone was added in O.
973
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
974
+            return false;
975
+        }
976
+        super.onRenderProcessGone(webView, detail);
977
+
978
+        if(detail.didCrash()){
979
+          Log.e("RNCWebViewManager", "The WebView rendering process crashed.");
980
+        }
981
+        else{
982
+          Log.w("RNCWebViewManager", "The WebView rendering process was killed by the system.");
983
+        }
984
+
985
+        // if webView is null, we cannot return any event
986
+        // since the view is already dead/disposed
987
+        // still prevent the app crash by returning true.
988
+        if(webView == null){
989
+          return true;
990
+        }
991
+
992
+        WritableMap event = createWebViewEvent(webView, webView.getUrl());
993
+        event.putBoolean("didCrash", detail.didCrash());
994
+
995
+        dispatchEvent(
996
+          webView,
997
+          new TopRenderProcessGoneEvent(webView.getId(), event)
998
+        );
999
+
1000
+        // returning false would crash the app.
1001
+        return true;
1002
+    }
1003
+
902
     protected void emitFinishEvent(WebView webView, String url) {
1004
     protected void emitFinishEvent(WebView webView, String url) {
903
       dispatchEvent(
1005
       dispatchEvent(
904
         webView,
1006
         webView,
1105
      */
1207
      */
1106
     public RNCWebView(ThemedReactContext reactContext) {
1208
     public RNCWebView(ThemedReactContext reactContext) {
1107
       super(reactContext);
1209
       super(reactContext);
1210
+      this.createCatalystInstance();
1108
       progressChangedFilter = new ProgressChangedFilter();
1211
       progressChangedFilter = new ProgressChangedFilter();
1109
     }
1212
     }
1110
 
1213
 
1213
 
1316
 
1214
       if (enabled) {
1317
       if (enabled) {
1215
         addJavascriptInterface(createRNCWebViewBridge(this), JAVASCRIPT_INTERFACE);
1318
         addJavascriptInterface(createRNCWebViewBridge(this), JAVASCRIPT_INTERFACE);
1216
-        this.createCatalystInstance();
1217
       } else {
1319
       } else {
1218
         removeJavascriptInterface(JAVASCRIPT_INTERFACE);
1320
         removeJavascriptInterface(JAVASCRIPT_INTERFACE);
1219
       }
1321
       }
1269
             data.putString("data", message);
1371
             data.putString("data", message);
1270
 
1372
 
1271
             if (mCatalystInstance != null) {
1373
             if (mCatalystInstance != null) {
1272
-              mContext.sendDirectMessage(data);
1374
+              mContext.sendDirectMessage("onMessage", data);
1273
             } else {
1375
             } else {
1274
               dispatchEvent(webView, new TopMessageEvent(webView.getId(), data));
1376
               dispatchEvent(webView, new TopMessageEvent(webView.getId(), data));
1275
             }
1377
             }
1280
         eventData.putString("data", message);
1382
         eventData.putString("data", message);
1281
 
1383
 
1282
         if (mCatalystInstance != null) {
1384
         if (mCatalystInstance != null) {
1283
-          this.sendDirectMessage(eventData);
1385
+          this.sendDirectMessage("onMessage", eventData);
1284
         } else {
1386
         } else {
1285
           dispatchEvent(this, new TopMessageEvent(this.getId(), eventData));
1387
           dispatchEvent(this, new TopMessageEvent(this.getId(), eventData));
1286
         }
1388
         }
1287
       }
1389
       }
1288
     }
1390
     }
1289
 
1391
 
1290
-    protected void sendDirectMessage(WritableMap data) {
1392
+    protected void sendDirectMessage(final String method, WritableMap data) {
1291
       WritableNativeMap event = new WritableNativeMap();
1393
       WritableNativeMap event = new WritableNativeMap();
1292
       event.putMap("nativeEvent", data);
1394
       event.putMap("nativeEvent", data);
1293
 
1395
 
1294
       WritableNativeArray params = new WritableNativeArray();
1396
       WritableNativeArray params = new WritableNativeArray();
1295
       params.pushMap(event);
1397
       params.pushMap(event);
1296
 
1398
 
1297
-      mCatalystInstance.callFunction(messagingModuleName, "onMessage", params);
1399
+      mCatalystInstance.callFunction(messagingModuleName, method, params);
1298
     }
1400
     }
1299
 
1401
 
1300
     protected void onScrollChanged(int x, int y, int oldX, int oldY) {
1402
     protected void onScrollChanged(int x, int y, int oldX, int oldY) {

+ 45
- 1
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java Datei anzeigen

12
 import android.os.Parcelable;
12
 import android.os.Parcelable;
13
 import android.provider.MediaStore;
13
 import android.provider.MediaStore;
14
 
14
 
15
+import androidx.annotation.Nullable;
15
 import androidx.annotation.RequiresApi;
16
 import androidx.annotation.RequiresApi;
16
 import androidx.core.content.ContextCompat;
17
 import androidx.core.content.ContextCompat;
17
 import androidx.core.content.FileProvider;
18
 import androidx.core.content.FileProvider;
19
+import androidx.core.util.Pair;
18
 
20
 
19
 import android.util.Log;
21
 import android.util.Log;
20
 import android.webkit.MimeTypeMap;
22
 import android.webkit.MimeTypeMap;
35
 import java.io.IOException;
37
 import java.io.IOException;
36
 import java.util.ArrayList;
38
 import java.util.ArrayList;
37
 import java.util.Arrays;
39
 import java.util.Arrays;
40
+import java.util.HashMap;
41
+import java.util.concurrent.atomic.AtomicReference;
38
 
42
 
39
 import static android.app.Activity.RESULT_OK;
43
 import static android.app.Activity.RESULT_OK;
40
 
44
 
50
   private File outputVideo;
54
   private File outputVideo;
51
   private DownloadManager.Request downloadRequest;
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
   private enum MimeType {
86
   private enum MimeType {
54
     DEFAULT("*/*"),
87
     DEFAULT("*/*"),
55
     IMAGE("image"),
88
     IMAGE("image"),
105
     promise.resolve(result);
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
   public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
152
   public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
109
 
153
 
110
     if (filePathCallback == null && filePathCallbackLegacy == null) {
154
     if (filePathCallback == null && filePathCallbackLegacy == null) {
273
 
317
 
274
   public boolean grantFileDownloaderPermissions() {
318
   public boolean grantFileDownloaderPermissions() {
275
     // Permission not required for Android Q and above
319
     // Permission not required for Android Q and above
276
-    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
320
+    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
277
       return true;
321
       return true;
278
     }
322
     }
279
 
323
 

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

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 Datei anzeigen

14
 
14
 
15
   init {
15
   init {
16
     mData.putString("navigationType", "other")
16
     mData.putString("navigationType", "other")
17
+    // Android does not raise shouldOverrideUrlLoading for inner frames
18
+    mData.putBoolean("isTopFrame", true)
17
   }
19
   }
18
 
20
 
19
   override fun getEventName(): String = EVENT_NAME
21
   override fun getEventName(): String = EVENT_NAME

+ 8
- 0
apple/RNCWebView.h Datei anzeigen

63
 @property (nonatomic, assign) BOOL directionalLockEnabled;
63
 @property (nonatomic, assign) BOOL directionalLockEnabled;
64
 @property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
64
 @property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
65
 @property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
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
66
 
72
 
67
 + (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;
73
 + (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;
68
 + (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates;
74
 + (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates;
72
 - (void)goBack;
78
 - (void)goBack;
73
 - (void)reload;
79
 - (void)reload;
74
 - (void)stopLoading;
80
 - (void)stopLoading;
81
+- (void)addPullToRefreshControl;
82
+- (void)pullToRefresh:(UIRefreshControl *)refreshControl;
75
 
83
 
76
 @end
84
 @end

+ 48
- 38
apple/RNCWebView.m Datei anzeigen

227
   }
227
   }
228
   wkWebViewConfig.userContentController = [WKUserContentController new];
228
   wkWebViewConfig.userContentController = [WKUserContentController new];
229
 
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
+
230
   // Shim the HTML5 history API:
238
   // Shim the HTML5 history API:
231
   [wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]
239
   [wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]
232
                                                             name:HistoryShimName];
240
                                                             name:HistoryShimName];
268
     _webView.UIDelegate = self;
276
     _webView.UIDelegate = self;
269
     _webView.navigationDelegate = self;
277
     _webView.navigationDelegate = self;
270
 #if !TARGET_OS_OSX
278
 #if !TARGET_OS_OSX
279
+    if (_pullToRefreshEnabled) {
280
+        [self addPullToRefreshControl];
281
+    }
271
     _webView.scrollView.scrollEnabled = _scrollEnabled;
282
     _webView.scrollView.scrollEnabled = _scrollEnabled;
272
     _webView.scrollView.pagingEnabled = _pagingEnabled;
283
     _webView.scrollView.pagingEnabled = _pagingEnabled;
273
-    _webView.scrollView.bounces = _bounces;
284
+      //For UIRefreshControl to work correctly, the bounces should always be true
285
+    _webView.scrollView.bounces = _pullToRefreshEnabled || _bounces; 
274
     _webView.scrollView.showsHorizontalScrollIndicator = _showsHorizontalScrollIndicator;
286
     _webView.scrollView.showsHorizontalScrollIndicator = _showsHorizontalScrollIndicator;
275
     _webView.scrollView.showsVerticalScrollIndicator = _showsVerticalScrollIndicator;
287
     _webView.scrollView.showsVerticalScrollIndicator = _showsVerticalScrollIndicator;
276
     _webView.scrollView.directionalLockEnabled = _directionalLockEnabled;
288
     _webView.scrollView.directionalLockEnabled = _directionalLockEnabled;
301
   _webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
313
   _webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
302
 }
314
 }
303
 
315
 
304
-
305
 - (void)removeFromSuperview
316
 - (void)removeFromSuperview
306
 {
317
 {
307
     if (_webView) {
318
     if (_webView) {
878
  * topViewController
889
  * topViewController
879
  */
890
  */
880
 -(UIViewController *)topViewController{
891
 -(UIViewController *)topViewController{
881
-    UIViewController *controller = [self topViewControllerWithRootViewController:[self getCurrentWindow].rootViewController];
882
-    return controller;
892
+    return RCTPresentedViewController();
883
 }
893
 }
884
 
894
 
885
-/**
886
- * topViewControllerWithRootViewController
887
- */
888
--(UIViewController *)topViewControllerWithRootViewController:(UIViewController *)viewController{
889
-  if (viewController==nil) return nil;
890
-  if (viewController.presentedViewController!=nil) {
891
-    return [self topViewControllerWithRootViewController:viewController.presentedViewController];
892
-  } else if ([viewController isKindOfClass:[UITabBarController class]]){
893
-    return [self topViewControllerWithRootViewController:[(UITabBarController *)viewController selectedViewController]];
894
-  } else if ([viewController isKindOfClass:[UINavigationController class]]){
895
-    return [self topViewControllerWithRootViewController:[(UINavigationController *)viewController visibleViewController]];
896
-  } else {
897
-    return viewController;
898
-  }
899
-}
900
-/**
901
- * getCurrentWindow
902
- */
903
--(UIWindow *)getCurrentWindow{
904
-  UIWindow *window = [UIApplication sharedApplication].keyWindow;
905
-  if (window.windowLevel!=UIWindowLevelNormal) {
906
-    for (UIWindow *wid in [UIApplication sharedApplication].windows) {
907
-      if (window.windowLevel==UIWindowLevelNormal) {
908
-        window = wid;
909
-        break;
910
-      }
911
-    }
912
-  }
913
-  return window;
914
-}
915
 #endif // !TARGET_OS_OSX
895
 #endif // !TARGET_OS_OSX
916
 
896
 
917
 /**
897
 /**
938
 
918
 
939
   WKNavigationType navigationType = navigationAction.navigationType;
919
   WKNavigationType navigationType = navigationAction.navigationType;
940
   NSURLRequest *request = navigationAction.request;
920
   NSURLRequest *request = navigationAction.request;
921
+  BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL];
941
 
922
 
942
   if (_onShouldStartLoadWithRequest) {
923
   if (_onShouldStartLoadWithRequest) {
943
     NSMutableDictionary<NSString *, id> *event = [self baseEvent];
924
     NSMutableDictionary<NSString *, id> *event = [self baseEvent];
944
     [event addEntriesFromDictionary: @{
925
     [event addEntriesFromDictionary: @{
945
       @"url": (request.URL).absoluteString,
926
       @"url": (request.URL).absoluteString,
946
       @"mainDocumentURL": (request.mainDocumentURL).absoluteString,
927
       @"mainDocumentURL": (request.mainDocumentURL).absoluteString,
947
-      @"navigationType": navigationTypes[@(navigationType)]
928
+      @"navigationType": navigationTypes[@(navigationType)],
929
+      @"isTopFrame": @(isTopFrame)
948
     }];
930
     }];
949
     if (![self.delegate webView:self
931
     if (![self.delegate webView:self
950
       shouldStartLoadForRequest:event
932
       shouldStartLoadForRequest:event
956
 
938
 
957
   if (_onLoadingStart) {
939
   if (_onLoadingStart) {
958
     // We have this check to filter out iframe requests and whatnot
940
     // We have this check to filter out iframe requests and whatnot
959
-    BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL];
960
     if (isTopFrame) {
941
     if (isTopFrame) {
961
       NSMutableDictionary<NSString *, id> *event = [self baseEvent];
942
       NSMutableDictionary<NSString *, id> *event = [self baseEvent];
962
       [event addEntriesFromDictionary: @{
943
       [event addEntriesFromDictionary: @{
1156
   }
1137
   }
1157
 }
1138
 }
1158
 
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
+
1159
 - (void)stopLoading
1169
 - (void)stopLoading
1160
 {
1170
 {
1161
   [_webView stopLoading];
1171
   [_webView stopLoading];
1165
 - (void)setBounces:(BOOL)bounces
1175
 - (void)setBounces:(BOOL)bounces
1166
 {
1176
 {
1167
   _bounces = bounces;
1177
   _bounces = bounces;
1168
-  _webView.scrollView.bounces = bounces;
1178
+    //For UIRefreshControl to work correctly, the bounces should always be true
1179
+  _webView.scrollView.bounces = _pullToRefreshEnabled || bounces;
1169
 }
1180
 }
1170
 #endif // !TARGET_OS_OSX
1181
 #endif // !TARGET_OS_OSX
1171
 
1182
 
1172
-
1173
 - (void)setInjectedJavaScript:(NSString *)source {
1183
 - (void)setInjectedJavaScript:(NSString *)source {
1174
   _injectedJavaScript = source;
1184
   _injectedJavaScript = source;
1175
 
1185
 

+ 18
- 0
apple/RNCWebViewManager.m Datei anzeigen

14
 @interface RNCWebViewManager () <RNCWebViewDelegate>
14
 @interface RNCWebViewManager () <RNCWebViewDelegate>
15
 @end
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
 @implementation RNCWebViewManager
27
 @implementation RNCWebViewManager
18
 {
28
 {
19
   NSConditionLock *_shouldStartLoadLock;
29
   NSConditionLock *_shouldStartLoadLock;
71
 RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior)
81
 RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior)
72
 #endif
82
 #endif
73
 
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
+
74
 /**
88
 /**
75
  * Expose methods to enable messaging the webview.
89
  * Expose methods to enable messaging the webview.
76
  */
90
  */
90
   }];
104
   }];
91
 }
105
 }
92
 
106
 
107
+RCT_CUSTOM_VIEW_PROPERTY(pullToRefreshEnabled, BOOL, RNCWebView) {
108
+    view.pullToRefreshEnabled = json == nil ? false : [RCTConvert BOOL: json];
109
+}
110
+
93
 RCT_CUSTOM_VIEW_PROPERTY(bounces, BOOL, RNCWebView) {
111
 RCT_CUSTOM_VIEW_PROPERTY(bounces, BOOL, RNCWebView) {
94
   view.bounces = json == nil ? true : [RCTConvert BOOL: json];
112
   view.bounces = json == nil ? true : [RCTConvert BOOL: json];
95
 }
113
 }

+ 3
- 1
docs/Debugging.md Datei anzeigen

15
 3. Safari -> Develop -> [device name] -> [app name] -> [url - title]
15
 3. Safari -> Develop -> [device name] -> [app name] -> [url - title]
16
 4. You can now debug the WebView contents just as you would on the web
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
 When debugging on device you must enable Web Inspector in your device settings:
20
 When debugging on device you must enable Web Inspector in your device settings:
21
 
21
 
22
 Settings -> Safari -> Advanced -> Web Inspector
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
 ### Android & Chrome
26
 ### Android & Chrome
25
 
27
 
26
 It's possible to debug WebView contents in the Android emulator or on a device using Chrome DevTools.
28
 It's possible to debug WebView contents in the Android emulator or on a device using Chrome DevTools.

+ 3
- 2
docs/Guide.md Datei anzeigen

305
             uri:
305
             uri:
306
               'https://github.com/react-native-community/react-native-webview',
306
               'https://github.com/react-native-community/react-native-webview',
307
           }}
307
           }}
308
+          onMessage={(event) => {}}
308
           injectedJavaScript={runFirst}
309
           injectedJavaScript={runFirst}
309
         />
310
         />
310
       </View>
311
       </View>
313
 }
314
 }
314
 ```
315
 ```
315
 
316
 
316
-This runs the JavaScript in the `runFirst` string once the page is loaded. In this case, you can see that both the body style was changed to red and the alert showed up after 2 seconds.
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.
317
 
318
 
318
 By setting `injectedJavaScriptForMainFrameOnly: false`, the JavaScript injection will occur on all frames (not just the main frame) if supported for the given platform. For example, if a page contains an iframe, the javascript will be injected into that iframe as well with this set to `false`. (Note this is not supported on Android.) There is also `injectedJavaScriptBeforeContentLoadedForMainFrameOnly` for injecting prior to content loading. Read more about this in the [Reference](./Reference.md#injectedjavascriptformainframeonly).
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).
319
 
320
 
508
 
509
 
509
 You can set cookies on the React Native side using the [@react-native-community/cookies](https://github.com/react-native-community/cookies) package.
510
 You can set cookies on the React Native side using the [@react-native-community/cookies](https://github.com/react-native-community/cookies) package.
510
 
511
 
511
-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.
512
 
513
 
513
 ```jsx
514
 ```jsx
514
 const App = () => {
515
 const App = () => {

+ 161
- 80
docs/Reference.md Datei anzeigen

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

+ 100
- 100
example/android/gradlew.bat Datei anzeigen

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

+ 42
- 42
example/macos/Podfile Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 47
- 47
example/macos/example-macOS/Info.plist Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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>

+ 24
- 24
example/windows/WebViewWindows/pch.h Datei anzeigen

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
 #include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h>
25
 #include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h>

+ 24
- 1
index.d.ts Datei anzeigen

6
 
6
 
7
 export type WebViewProps = IOSWebViewProps & AndroidWebViewProps;
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
      * Go back one page in the webview's history.
11
      * Go back one page in the webview's history.
12
      */
12
      */
41
      * Focuses on WebView redered page.
41
      * Focuses on WebView redered page.
42
      */
42
      */
43
     requestFocus: () => void;
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
 export {WebView};
69
 export {WebView};

+ 2
- 0
metro.config.windows.js Datei anzeigen

35
       new RegExp(
35
       new RegExp(
36
         `${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
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
   transformer: {
42
   transformer: {

+ 90
- 91
package.json Datei anzeigen

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

+ 17
- 3
src/WebView.android.tsx Datei anzeigen

21
   defaultRenderLoading,
21
   defaultRenderLoading,
22
 } from './WebViewShared';
22
 } from './WebViewShared';
23
 import {
23
 import {
24
+  WebViewRenderProcessGoneEvent,
24
   WebViewErrorEvent,
25
   WebViewErrorEvent,
25
   WebViewHttpErrorEvent,
26
   WebViewHttpErrorEvent,
26
   WebViewMessageEvent,
27
   WebViewMessageEvent,
60
     saveFormDataDisabled: false,
61
     saveFormDataDisabled: false,
61
     cacheEnabled: true,
62
     cacheEnabled: true,
62
     androidHardwareAccelerationDisabled: false,
63
     androidHardwareAccelerationDisabled: false,
64
+    androidLayerType: 'none',
63
     originWhitelist: defaultOriginWhitelist,
65
     originWhitelist: defaultOriginWhitelist,
64
   };
66
   };
65
 
67
 
75
     lastErrorEvent: null,
77
     lastErrorEvent: null,
76
   };
78
   };
77
 
79
 
80
+  onShouldStartLoadWithRequest: ReturnType<typeof createOnShouldStartLoadWithRequest> | null = null;
78
 
81
 
79
   webViewRef = React.createRef<NativeWebViewAndroid>();
82
   webViewRef = React.createRef<NativeWebViewAndroid>();
80
 
83
 
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
   onLoadingFinish = (event: WebViewNavigationEvent) => {
241
   onLoadingFinish = (event: WebViewNavigationEvent) => {
232
     const { onLoad, onLoadEnd } = this.props;
242
     const { onLoad, onLoadEnd } = this.props;
233
     const { nativeEvent: { url } } = event;
243
     const { nativeEvent: { url } } = event;
271
   onShouldStartLoadWithRequestCallback = (
281
   onShouldStartLoadWithRequestCallback = (
272
     shouldStart: boolean,
282
     shouldStart: boolean,
273
     url: string,
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
       UIManager.dispatchViewManagerCommand(
289
       UIManager.dispatchViewManagerCommand(
277
         this.getWebViewHandle(),
290
         this.getWebViewHandle(),
278
         this.getCommands().loadUrl,
291
         this.getCommands().loadUrl,
329
     const NativeWebView
342
     const NativeWebView
330
       = (nativeConfig.component as typeof NativeWebViewAndroid) || RNCWebView;
343
       = (nativeConfig.component as typeof NativeWebViewAndroid) || RNCWebView;
331
 
344
 
332
-    const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
345
+    this.onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
333
       this.onShouldStartLoadWithRequestCallback,
346
       this.onShouldStartLoadWithRequestCallback,
334
       // casting cause it's in the default props
347
       // casting cause it's in the default props
335
       originWhitelist as readonly string[],
348
       originWhitelist as readonly string[],
347
         onLoadingProgress={this.onLoadingProgress}
360
         onLoadingProgress={this.onLoadingProgress}
348
         onLoadingStart={this.onLoadingStart}
361
         onLoadingStart={this.onLoadingStart}
349
         onHttpError={this.onHttpError}
362
         onHttpError={this.onHttpError}
363
+        onRenderProcessGone={this.onRenderProcessGone}
350
         onMessage={this.onMessage}
364
         onMessage={this.onMessage}
351
-        onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
365
+        onShouldStartLoadWithRequest={this.onShouldStartLoadWithRequest}
352
         ref={this.webViewRef}
366
         ref={this.webViewRef}
353
         // TODO: find a better way to type this.
367
         // TODO: find a better way to type this.
354
         source={resolveAssetSource(source as ImageSourcePropType)}
368
         source={resolveAssetSource(source as ImageSourcePropType)}

+ 266
- 266
src/WebView.windows.tsx Datei anzeigen

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
-}
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 Datei anzeigen

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

+ 68
- 10
src/WebViewTypes.ts Datei anzeigen

113
   mainDocumentURL?: string;
113
   mainDocumentURL?: string;
114
 }
114
 }
115
 
115
 
116
+export interface ShouldStartLoadRequest extends WebViewNavigation {
117
+  isTopFrame: boolean;
118
+}
119
+
116
 export interface FileDownload {
120
 export interface FileDownload {
117
   downloadUrl: string;
121
   downloadUrl: string;
118
 }
122
 }
137
   statusCode: number;
141
   statusCode: number;
138
 }
142
 }
139
 
143
 
144
+export interface WebViewRenderProcessGoneDetail {
145
+  didCrash: boolean;
146
+}
147
+
140
 export type WebViewEvent = NativeSyntheticEvent<WebViewNativeEvent>;
148
 export type WebViewEvent = NativeSyntheticEvent<WebViewNativeEvent>;
141
 
149
 
142
 export type WebViewProgressEvent = NativeSyntheticEvent<
150
 export type WebViewProgressEvent = NativeSyntheticEvent<
145
 
153
 
146
 export type WebViewNavigationEvent = NativeSyntheticEvent<WebViewNavigation>;
154
 export type WebViewNavigationEvent = NativeSyntheticEvent<WebViewNavigation>;
147
 
155
 
156
+export type ShouldStartLoadRequestEvent = NativeSyntheticEvent<ShouldStartLoadRequest>;
157
+
148
 export type FileDownloadEvent = NativeSyntheticEvent<FileDownload>;
158
 export type FileDownloadEvent = NativeSyntheticEvent<FileDownload>;
149
 
159
 
150
 export type WebViewMessageEvent = NativeSyntheticEvent<WebViewMessage>;
160
 export type WebViewMessageEvent = NativeSyntheticEvent<WebViewMessage>;
155
 
165
 
156
 export type WebViewHttpErrorEvent = NativeSyntheticEvent<WebViewHttpError>;
166
 export type WebViewHttpErrorEvent = NativeSyntheticEvent<WebViewHttpError>;
157
 
167
 
168
+export type WebViewRenderProcessGoneEvent = NativeSyntheticEvent<WebViewRenderProcessGoneDetail>;
169
+
158
 export type DataDetectorTypes =
170
 export type DataDetectorTypes =
159
   | 'phoneNumber'
171
   | 'phoneNumber'
160
   | 'link'
172
   | 'link'
170
 
182
 
171
 export type CacheMode = 'LOAD_DEFAULT' | 'LOAD_CACHE_ONLY' | 'LOAD_CACHE_ELSE_NETWORK' | 'LOAD_NO_CACHE';
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
 export interface WebViewSourceUri {
187
 export interface WebViewSourceUri {
174
   /**
188
   /**
175
    * The URI to load in the `WebView`. Can be a local or remote file.
189
    * The URI to load in the `WebView`. Can be a local or remote file.
232
 }
246
 }
233
 
247
 
234
 export type OnShouldStartLoadWithRequest = (
248
 export type OnShouldStartLoadWithRequest = (
235
-  event: WebViewNavigation,
249
+  event: ShouldStartLoadRequest,
236
 ) => boolean;
250
 ) => boolean;
237
 
251
 
238
 export interface CommonNativeWebViewProps extends ViewProps {
252
 export interface CommonNativeWebViewProps extends ViewProps {
252
   onLoadingStart: (event: WebViewNavigationEvent) => void;
266
   onLoadingStart: (event: WebViewNavigationEvent) => void;
253
   onHttpError: (event: WebViewHttpErrorEvent) => void;
267
   onHttpError: (event: WebViewHttpErrorEvent) => void;
254
   onMessage: (event: WebViewMessageEvent) => void;
268
   onMessage: (event: WebViewMessageEvent) => void;
255
-  onShouldStartLoadWithRequest: (event: WebViewNavigationEvent) => void;
269
+  onShouldStartLoadWithRequest: (event: ShouldStartLoadRequestEvent) => void;
256
   showsHorizontalScrollIndicator?: boolean;
270
   showsHorizontalScrollIndicator?: boolean;
257
   showsVerticalScrollIndicator?: boolean;
271
   showsVerticalScrollIndicator?: boolean;
258
   // TODO: find a better way to type this.
272
   // TODO: find a better way to type this.
260
   source: any;
274
   source: any;
261
   userAgent?: string;
275
   userAgent?: string;
262
   /**
276
   /**
263
-   * Append to the existing user-agent. Overriden if `userAgent` is set.
277
+   * Append to the existing user-agent. Overridden if `userAgent` is set.
264
    */
278
    */
265
   applicationNameForUserAgent?: string;
279
   applicationNameForUserAgent?: string;
266
 }
280
 }
272
   allowFileAccessFromFileURLs?: boolean;
286
   allowFileAccessFromFileURLs?: boolean;
273
   allowUniversalAccessFromFileURLs?: boolean;
287
   allowUniversalAccessFromFileURLs?: boolean;
274
   androidHardwareAccelerationDisabled?: boolean;
288
   androidHardwareAccelerationDisabled?: boolean;
289
+  androidLayerType?: AndroidLayerType;
275
   domStorageEnabled?: boolean;
290
   domStorageEnabled?: boolean;
276
   geolocationEnabled?: boolean;
291
   geolocationEnabled?: boolean;
277
   javaScriptEnabled?: boolean;
292
   javaScriptEnabled?: boolean;
278
   mixedContentMode?: 'never' | 'always' | 'compatibility';
293
   mixedContentMode?: 'never' | 'always' | 'compatibility';
279
   onContentSizeChange?: (event: WebViewEvent) => void;
294
   onContentSizeChange?: (event: WebViewEvent) => void;
295
+  onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void;
280
   overScrollMode?: OverScrollModeType;
296
   overScrollMode?: OverScrollModeType;
281
   saveFormDataDisabled?: boolean;
297
   saveFormDataDisabled?: boolean;
282
   textZoom?: number;
298
   textZoom?: number;
285
   readonly urlPrefixesForDefaultIntent?: string[];
301
   readonly urlPrefixesForDefaultIntent?: string[];
286
 }
302
 }
287
 
303
 
288
-export enum ContentInsetAdjustmentBehavior {
289
-  automatic = 'automatic',
290
-  scrollableAxes = 'scrollableAxes',
291
-  never = 'never',
292
-  always = 'always'
293
-};
304
+export declare type ContentInsetAdjustmentBehavior = 'automatic' | 'scrollableAxes' | 'never' | 'always';
305
+
306
+export declare type ContentMode = 'recommended' | 'mobile' | 'desktop';
294
 
307
 
295
 export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
308
 export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
296
   allowingReadAccessToURL?: string;
309
   allowingReadAccessToURL?: string;
302
   bounces?: boolean;
315
   bounces?: boolean;
303
   contentInset?: ContentInsetProp;
316
   contentInset?: ContentInsetProp;
304
   contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior;
317
   contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior;
318
+  contentMode?: ContentMode;
305
   readonly dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[];
319
   readonly dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[];
306
   decelerationRate?: number;
320
   decelerationRate?: number;
307
   directionalLockEnabled?: boolean;
321
   directionalLockEnabled?: boolean;
399
    */
413
    */
400
   contentInset?: ContentInsetProp;
414
   contentInset?: ContentInsetProp;
401
 
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
+
402
   /**
428
   /**
403
    * Determines the types of data converted to clickable URLs in the web view's content.
429
    * Determines the types of data converted to clickable URLs in the web view's content.
404
    * By default only phone numbers are detected.
430
    * By default only phone numbers are detected.
531
   */
557
   */
532
   injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
558
   injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
533
 
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
+
534
   /**
569
   /**
535
    * Function that is invoked when the client needs to download a file.
570
    * Function that is invoked when the client needs to download a file.
536
    *
571
    *
691
   onNavigationStateChange?: (event: WebViewNavigation) => void;
726
   onNavigationStateChange?: (event: WebViewNavigation) => void;
692
   onContentSizeChange?: (event: WebViewEvent) => void;
727
   onContentSizeChange?: (event: WebViewEvent) => void;
693
 
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
+
694
   /**
735
   /**
695
    * https://developer.android.com/reference/android/webkit/WebSettings.html#setCacheMode(int)
736
    * https://developer.android.com/reference/android/webkit/WebSettings.html#setCacheMode(int)
696
    * Set the cacheMode. Possible values are:
737
    * Set the cacheMode. Possible values are:
729
    */
770
    */
730
   geolocationEnabled?: boolean;
771
   geolocationEnabled?: boolean;
731
 
772
 
732
-  
773
+
733
   /**
774
   /**
734
    * Boolean that sets whether JavaScript running in the context of a file
775
    * Boolean that sets whether JavaScript running in the context of a file
735
    * scheme URL should be allowed to access content from other file scheme URLs.
776
    * scheme URL should be allowed to access content from other file scheme URLs.
774
    */
815
    */
775
   androidHardwareAccelerationDisabled?: boolean;
816
   androidHardwareAccelerationDisabled?: boolean;
776
 
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
+
777
   /**
830
   /**
778
    * Boolean value to enable third party cookies in the `WebView`. Used on
831
    * Boolean value to enable third party cookies in the `WebView`. Used on
779
    * Android Lollipop and above only as third party cookies are enabled by
832
    * Android Lollipop and above only as third party cookies are enabled by
981
    * Should caching be enabled. Default is true.
1034
    * Should caching be enabled. Default is true.
982
    */
1035
    */
983
   cacheEnabled?: boolean;
1036
   cacheEnabled?: boolean;
1037
+
1038
+  /**
1039
+   * Append to the existing user-agent. Overridden if `userAgent` is set.
1040
+   */
1041
+  applicationNameForUserAgent?: string;
984
 }
1042
 }

+ 204
- 204
windows/ReactNativeWebView.sln Datei anzeigen

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 Datei anzeigen

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
 </Project>
16
 </Project>

+ 3
- 3
windows/ReactNativeWebView/ReactNativeWebView.def Datei anzeigen

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 Datei anzeigen

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
 </Project>
33
 </Project>

+ 159
- 159
windows/ReactNativeWebView/ReactNativeWebView.vcxproj Datei anzeigen

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>
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>
160
 </Project>
160
 </Project>

+ 17
- 17
windows/ReactNativeWebView/ReactPackageProvider.cpp Datei anzeigen

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 Datei anzeigen

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 Datei anzeigen

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
- 147
windows/ReactNativeWebView/ReactWebView.cpp Datei anzeigen

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
-
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
+
148
 } // namespace winrt::ReactNativeWebView::implementation
148
 } // namespace winrt::ReactNativeWebView::implementation

+ 36
- 36
windows/ReactNativeWebView/ReactWebView.h Datei anzeigen

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> {};
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> {};
37
 } // namespace winrt::ReactNativeWebView::factory_implementation
37
 } // namespace winrt::ReactNativeWebView::factory_implementation

+ 7
- 7
windows/ReactNativeWebView/ReactWebView.idl Datei anzeigen

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
-    };
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
+    };
8
 } // namespace ReactNativeWebView
8
 } // namespace ReactNativeWebView

+ 144
- 144
windows/ReactNativeWebView/ReactWebViewManager.cpp Datei anzeigen

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
-
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
+
145
 } // namespace winrt::ReactWebView::implementation
145
 } // namespace winrt::ReactWebView::implementation

+ 3
- 3
windows/ReactNativeWebView/packages.config Datei anzeigen

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
 </packages>
4
 </packages>

+ 1
- 1
windows/ReactNativeWebView/pch.cpp Datei anzeigen

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

+ 13
- 13
windows/ReactNativeWebView/pch.h Datei anzeigen

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
- 13711
yarn.lock
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen