Ver código fonte

feat(Windows): Windows support! (#1220)

Kai Guo 4 anos atrás
pai
commit
ffee0d4362
Nenhuma conta vinculada ao e-mail do autor do commit
51 arquivos alterados com 13079 adições e 10190 exclusões
  1. 1
    0
      README.md
  2. 8
    0
      docs/Contributing.md
  3. 29
    0
      docs/Getting-Started.md
  4. 51
    51
      docs/Reference.md
  5. 92
    0
      example/windows/.gitignore
  6. 227
    0
      example/windows/WebViewWindows.sln
  7. 47
    0
      example/windows/WebViewWindows/App.cpp
  8. 15
    0
      example/windows/WebViewWindows/App.h
  9. 3
    0
      example/windows/WebViewWindows/App.idl
  10. 10
    0
      example/windows/WebViewWindows/App.xaml
  11. BIN
      example/windows/WebViewWindows/Assets/LockScreenLogo.scale-200.png
  12. BIN
      example/windows/WebViewWindows/Assets/SplashScreen.scale-200.png
  13. BIN
      example/windows/WebViewWindows/Assets/Square150x150Logo.scale-200.png
  14. BIN
      example/windows/WebViewWindows/Assets/Square44x44Logo.scale-200.png
  15. BIN
      example/windows/WebViewWindows/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
  16. BIN
      example/windows/WebViewWindows/Assets/StoreLogo.png
  17. BIN
      example/windows/WebViewWindows/Assets/Wide310x150Logo.scale-200.png
  18. 49
    0
      example/windows/WebViewWindows/Package.appxmanifest
  19. 16
    0
      example/windows/WebViewWindows/PropertySheet.props
  20. 2
    0
      example/windows/WebViewWindows/ReactAssets/.gitignore
  21. 20
    0
      example/windows/WebViewWindows/ReactPackageProvider.cpp
  22. 20
    0
      example/windows/WebViewWindows/ReactPackageProvider.h
  23. 180
    0
      example/windows/WebViewWindows/WebViewWindows.vcxproj
  24. 58
    0
      example/windows/WebViewWindows/WebViewWindows.vcxproj.filters
  25. BIN
      example/windows/WebViewWindows/WebViewWindows_TemporaryKey.pfx
  26. 5
    0
      example/windows/WebViewWindows/packages.config
  27. 1
    0
      example/windows/WebViewWindows/pch.cpp
  28. 25
    0
      example/windows/WebViewWindows/pch.h
  29. 48
    0
      metro.config.windows.js
  30. 86
    80
      package.json
  31. 8
    0
      react-native.config.js
  32. 258
    0
      src/WebView.windows.tsx
  33. 13
    0
      src/WebViewTypes.ts
  34. 353
    0
      windows/.gitignore
  35. 204
    0
      windows/ReactNativeWebView.sln
  36. 16
    0
      windows/ReactNativeWebView/PropertySheet.props
  37. 3
    0
      windows/ReactNativeWebView/ReactNativeWebView.def
  38. 33
    0
      windows/ReactNativeWebView/ReactNativeWebView.filters
  39. 162
    0
      windows/ReactNativeWebView/ReactNativeWebView.vcxproj
  40. 17
    0
      windows/ReactNativeWebView/ReactPackageProvider.cpp
  41. 20
    0
      windows/ReactNativeWebView/ReactPackageProvider.h
  42. 7
    0
      windows/ReactNativeWebView/ReactPackageProvider.idl
  43. 144
    0
      windows/ReactNativeWebView/ReactWebView.cpp
  44. 36
    0
      windows/ReactNativeWebView/ReactWebView.h
  45. 7
    0
      windows/ReactNativeWebView/ReactWebView.idl
  46. 144
    0
      windows/ReactNativeWebView/ReactWebViewManager.cpp
  47. 56
    0
      windows/ReactNativeWebView/ReactWebViewManager.h
  48. 4
    0
      windows/ReactNativeWebView/packages.config
  49. 1
    0
      windows/ReactNativeWebView/pch.cpp
  50. 13
    0
      windows/ReactNativeWebView/pch.h
  51. 10587
    10059
      yarn.lock

+ 1
- 0
README.md Ver arquivo

@@ -21,6 +21,7 @@ _This project is maintained for free by these people using both their free time
21 21
 - [x] iOS
22 22
 - [x] Android
23 23
 - [x] macOS
24
+- [x] Windows
24 25
 
25 26
 _Note: Expo support for React Native WebView started with [Expo SDK v33.0.0](https://blog.expo.io/expo-sdk-v33-0-0-is-now-available-52d1c99dfe4c)._
26 27
 

+ 8
- 0
docs/Contributing.md Ver arquivo

@@ -44,6 +44,14 @@ $ yarn start:macos
44 44
 
45 45
 The Metro Bundler will now be running in the Terminal for react-native-macos.  In XCode select the `example-macos` target and Run.
46 46
 
47
+#### For Windows:
48
+```
49
+$ yarn start:windows
50
+$ open example/windows/WebViewWindows.sln and click run button.
51
+```
52
+
53
+The Metro Bundler will now be running in the Terminal for react-native-windows and the example app will be install and started
54
+
47 55
 ### Testing in a new `react-native init` project
48 56
 
49 57
 In a new `react-native init` project, do this:

+ 29
- 0
docs/Getting-Started.md Ver arquivo

@@ -60,6 +60,35 @@ Cocoapod and autolinking is not yet support for react-native macOS but is coming
60 60
 
61 61
 The method is nearly identical to the [manual linking method for iOS](https://reactnative.dev/docs/linking-libraries-ios#manual-linking) except that you will include the `node_modules/react-native-webview/macos/RNCWebView.xcodeproj` project in your main project and link the `RNCWebView-macOS.a` library.
62 62
 
63
+### Windows:
64
+
65
+Autolinking is not yet supported for ReactNativeWindows. Make following additions to the given files manually:
66
+
67
+#### **windows/myapp.sln**
68
+
69
+Add the `ReactNativeWebView` project to your solution.
70
+
71
+1. Open the solution in Visual Studio 2019
72
+2. Right-click Solution icon in Solution Explorer > Add > Existing Project
73
+   Select `node_modules\react-native-webview\windows\ReactNativeWebView\ReactNativeWebView.vcxproj`
74
+
75
+#### **windows/myapp/myapp.vcxproj**
76
+
77
+Add a reference to `ReactNativeWebView` to your main application project. From Visual Studio 2019:
78
+
79
+1. Right-click main application project > Add > Reference...
80
+  Check `ReactNativeWebView` from Solution Projects.
81
+
82
+2. Modify files below to add the package providers to your main application project
83
+
84
+#### **pch.h**
85
+
86
+Add `#include "winrt/ReactNativeWebView.h"`.
87
+
88
+#### **app.cpp**
89
+
90
+Add `PackageProviders().Append(winrt::ReactNativeWebView::ReactPackageProvider());` before `InitializeComponent();`.
91
+
63 92
 ## 3. Import the webview into your component
64 93
 
65 94
 ```js

+ 51
- 51
docs/Reference.md Ver arquivo

@@ -122,9 +122,9 @@ Controls whether to adjust the content inset for web views that are placed behin
122 122
 
123 123
 Set this to provide JavaScript that will be injected into the web page when the view loads. Make sure the string evaluates to a valid type (`true` works) and doesn't otherwise throw an exception.
124 124
 
125
-| Type   | Required |
126
-| ------ | -------- |
127
-| string | No       |
125
+| Type   | Required | Platform |
126
+| ------ | -------- | -------- |
127
+| string | No       | iOS, Andrdoid, macOS
128 128
 
129 129
 To learn more, read the [Communicating between JS and Native](Guide.md#communicating-between-js-and-native) guide.
130 130
 
@@ -151,9 +151,9 @@ const INJECTED_JAVASCRIPT = `(function() {
151 151
 Set this to provide JavaScript that will be injected into the web page after the document element is created, but before any other content is loaded. Make sure the string evaluates to a valid type (`true` works) and doesn't otherwise throw an exception.
152 152
 On iOS, see [WKUserScriptInjectionTimeAtDocumentStart](https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime/wkuserscriptinjectiontimeatdocumentstart?language=objc)
153 153
 
154
-| Type   | Required |
155
-| ------ | -------- |
156
-| string | No       |
154
+| Type   | Required | Platform |
155
+| ------ | -------- | -------- |
156
+| string | No       | iOS, Android, macOS |
157 157
 
158 158
 To learn more, read the [Communicating between JS and Native](Guide.md#communicating-between-js-and-native) guide.
159 159
 
@@ -181,9 +181,9 @@ Boolean that determines whether HTML5 audio and video requires the user to tap t
181 181
 
182 182
 NOTE: the default `true` value might cause some videos to hang loading on iOS. Setting it to `false` could fix this issue.
183 183
 
184
-| Type | Required |
185
-| ---- | -------- |
186
-| bool | No       |
184
+| Type | Required | Platform |
185
+| ---- | -------- | -------- |
186
+| bool | No       | iOS, Android, macOS |
187 187
 
188 188
 ---
189 189
 
@@ -197,9 +197,9 @@ The `nativeConfig` prop expects an object with the following keys:
197 197
 - `props` (object)
198 198
 - `viewManager` (object)
199 199
 
200
-| Type   | Required |
201
-| ------ | -------- |
202
-| object | No       |
200
+| Type   | Required | Platform |
201
+| ------ | -------- | -------- |
202
+| object | No       | iOS, Android, macOS |
203 203
 
204 204
 ---
205 205
 
@@ -348,9 +348,9 @@ url
348 348
 
349 349
 Function that is invoked when the `WebView` is loading.
350 350
 
351
-| Type     | Required |
352
-| -------- | -------- |
353
-| function | No       |
351
+| Type     | Required | Platform |
352
+| -------- | -------- | --------- |
353
+| function | No       | iOS, Android, macOS |
354 354
 
355 355
 Example:
356 356
 
@@ -509,9 +509,9 @@ url
509 509
 
510 510
 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://*".
511 511
 
512
-| Type             | Required |
513
-| ---------------- | -------- |
514
-| array of strings | No       |
512
+| Type             | Required | Platform |
513
+| ---------------- | -------- | -------- |
514
+| array of strings | No       | iOS, Android, macOS |
515 515
 
516 516
 Example:
517 517
 
@@ -529,9 +529,9 @@ Example:
529 529
 
530 530
 Function that returns a view to show if there's an error.
531 531
 
532
-| Type     | Required |
533
-| -------- | -------- |
534
-| function | No       |
532
+| Type     | Required | Platform |
533
+| -------- | -------- | -------- |
534
+| function | No       | iOS, Android, macOS |
535 535
 
536 536
 Example:
537 537
 
@@ -550,9 +550,9 @@ The function passed to `renderError` will be called with the name of the error
550 550
 
551 551
 Function that returns a loading indicator. The startInLoadingState prop must be set to true in order to use this prop.
552 552
 
553
-| Type     | Required |
554
-| -------- | -------- |
555
-| function | No       |
553
+| Type     | Required | Platform |
554
+| -------- | -------- | -------- |
555
+| function | No       | iOS, Android, macOS |
556 556
 
557 557
 Example:
558 558
 
@@ -582,9 +582,9 @@ Function that allows custom handling of any web view requests. Return `true` fro
582 582
 
583 583
 On Android, is not called on the first load.
584 584
 
585
-| Type     | Required |
586
-| -------- | -------- |
587
-| function | No       |
585
+| Type     | Required | Platform |
586
+| -------- | -------- | -------- |
587
+| function | No       | iOS, Android, macOS |
588 588
 
589 589
 Example:
590 590
 
@@ -618,9 +618,9 @@ navigationType
618 618
 
619 619
 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.
620 620
 
621
-| Type | Required |
622
-| ---- | -------- |
623
-| bool | No       |
621
+| Type | Required | Platform |
622
+| ---- | -------- | -------- |
623
+| bool | No       | iOS, Android, macOS |
624 624
 
625 625
 ---
626 626
 
@@ -735,9 +735,9 @@ Boolean value to enable third party cookies in the `WebView`. Used on Android Lo
735 735
 
736 736
 Sets the user-agent for the `WebView`.
737 737
 
738
-| Type   | Required |
739
-| ------ | -------- |
740
-| string | No       |
738
+| Type   | Required | Platform |
739
+| ------ | -------- | -------- |
740
+| string | No       | iOS, Android, macOS |
741 741
 
742 742
 ---
743 743
 
@@ -745,9 +745,9 @@ Sets the user-agent for the `WebView`.
745 745
 
746 746
 Append to the existing user-agent. Setting `userAgent` will override this.
747 747
 
748
-| Type   | Required |
749
-| ------ | -------- |
750
-| string | No       |
748
+| Type   | Required | Platform |
749
+| ------ | -------- | -------- |
750
+| string | No       | iOS, Android, macOS |
751 751
 
752 752
 ```jsx
753 753
 <WebView
@@ -885,9 +885,9 @@ The default value is `true`.
885 885
 
886 886
 Boolean value that determines whether a horizontal scroll indicator is shown in the `WebView`. The default value is `true`.
887 887
 
888
-| Type | Required |
889
-| ---- | -------- |
890
-| bool | No       |
888
+| Type | Required | Platform |
889
+| ---- | -------- | -------- |
890
+| bool | No       | iOS, Android, macOS |
891 891
 
892 892
 ---
893 893
 
@@ -895,9 +895,9 @@ Boolean value that determines whether a horizontal scroll indicator is shown in
895 895
 
896 896
 Boolean value that determines whether a vertical scroll indicator is shown in the `WebView`. The default value is `true`.
897 897
 
898
-| Type | Required |
899
-| ---- | -------- |
900
-| bool | No       |
898
+| Type | Required | Platform |
899
+| ---- | -------- | -------- |
900
+| bool | No       | iOS, Android, macOS |
901 901
 
902 902
 ---
903 903
 
@@ -915,9 +915,9 @@ Set whether Geolocation is enabled in the `WebView`. The default value is `false
915 915
 
916 916
 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`.
917 917
 
918
-| Type | Required |
919
-| ---- | -------- |
920
-| bool | No       |
918
+| Type | Required | Platform |
919
+| ---- | -------- | -------- |
920
+| bool | No       | iOS, Android, macOS |
921 921
 
922 922
 ---
923 923
 
@@ -995,9 +995,9 @@ If true, this will be able horizontal swipe gestures. The default value is `fals
995 995
 
996 996
 Does not store any data within the lifetime of the WebView.
997 997
 
998
-| Type    | Required |
999
-| ------- | -------- |
1000
-| boolean | No       |
998
+| Type    | Required | Platform |
999
+| ------- | -------- | -------- |
1000
+| boolean | No       | iOS, Android, macOS |
1001 1001
 
1002 1002
 ---
1003 1003
 
@@ -1025,9 +1025,9 @@ Sets whether the WebView should disable saving form data. The default value is `
1025 1025
 
1026 1026
 Sets whether WebView should use browser caching.
1027 1027
 
1028
-| Type    | Required | Default |
1029
-| ------- | -------- | ------- |
1030
-| boolean | No       | true    |
1028
+| Type    | Required | Default | Platform |
1029
+| ------- | -------- | ------- | -------- |
1030
+| boolean | No       | true    | iOS, Android, macOS |
1031 1031
 
1032 1032
 ---
1033 1033
 

+ 92
- 0
example/windows/.gitignore Ver arquivo

@@ -0,0 +1,92 @@
1
+*AppPackages*
2
+*BundleArtifacts*
3
+
4
+#OS junk files
5
+[Tt]humbs.db
6
+*.DS_Store
7
+
8
+#Visual Studio files
9
+*.[Oo]bj
10
+*.user
11
+*.aps
12
+*.pch
13
+*.vspscc
14
+*.vssscc
15
+*_i.c
16
+*_p.c
17
+*.ncb
18
+*.suo
19
+*.tlb
20
+*.tlh
21
+*.bak
22
+*.[Cc]ache
23
+*.ilk
24
+*.log
25
+*.lib
26
+*.sbr
27
+*.sdf
28
+*.opensdf
29
+*.opendb
30
+*.unsuccessfulbuild
31
+ipch/
32
+[Oo]bj/
33
+[Bb]in
34
+[Dd]ebug*/
35
+[Rr]elease*/
36
+Ankh.NoLoad
37
+
38
+# Visual C++ cache files
39
+ipch/
40
+*.aps
41
+*.ncb
42
+*.opendb
43
+*.opensdf
44
+*.sdf
45
+*.cachefile
46
+*.VC.db
47
+*.VC.VC.opendb
48
+
49
+#MonoDevelop
50
+*.pidb
51
+*.userprefs
52
+
53
+#Tooling
54
+_ReSharper*/
55
+*.resharper
56
+[Tt]est[Rr]esult*
57
+*.sass-cache
58
+
59
+#Project files
60
+[Bb]uild/
61
+
62
+#Subversion files
63
+.svn
64
+
65
+# Office Temp Files
66
+~$*
67
+
68
+# vim Temp Files
69
+*~
70
+
71
+#NuGet
72
+packages/
73
+*.nupkg
74
+
75
+#ncrunch
76
+*ncrunch*
77
+*crunch*.local.xml
78
+
79
+# visual studio database projects
80
+*.dbmdl
81
+
82
+#Test files
83
+*.testsettings
84
+
85
+#Other files
86
+*.DotSettings
87
+.vs/
88
+*project.lock.json
89
+
90
+#Files generated by the VS build
91
+**/Generated Files/**
92
+

+ 227
- 0
example/windows/WebViewWindows.sln Ver arquivo

@@ -0,0 +1,227 @@
1
+
2
+Microsoft Visual Studio Solution File, Format Version 12.00
3
+# Visual Studio Version 16
4
+VisualStudioVersion = 16.0.29215.179
5
+MinimumVisualStudioVersion = 10.0.40219.1
6
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebViewWindows", "WebViewWindows\WebViewWindows.vcxproj", "{AC6C354F-8C80-47EA-9E40-996ABE271843}"
7
+	ProjectSection(ProjectDependencies) = postProject
8
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136} = {F7D32BD0-2749-483E-9A0D-1635EF7E3136}
9
+	EndProjectSection
10
+EndProject
11
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Folly", "..\..\node_modules\react-native-windows\Folly\Folly.vcxproj", "{A990658C-CE31-4BCC-976F-0FC6B1AF693D}"
12
+EndProject
13
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactCommon", "..\..\node_modules\react-native-windows\ReactCommon\ReactCommon.vcxproj", "{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}"
14
+	ProjectSection(ProjectDependencies) = postProject
15
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {A990658C-CE31-4BCC-976F-0FC6B1AF693D}
16
+	EndProjectSection
17
+EndProject
18
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactWindowsCore", "..\..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore.vcxproj", "{11C084A3-A57C-4296-A679-CAC17B603144}"
19
+	ProjectSection(ProjectDependencies) = postProject
20
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {A990658C-CE31-4BCC-976F-0FC6B1AF693D}
21
+	EndProjectSection
22
+EndProject
23
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Chakra", "..\..\node_modules\react-native-windows\Chakra\Chakra.vcxitems", "{C38970C0-5FBF-4D69-90D8-CBAC225AE895}"
24
+EndProject
25
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.ReactNative", "..\..\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj", "{F7D32BD0-2749-483E-9A0D-1635EF7E3136}"
26
+EndProject
27
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Shared", "..\..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems", "{0CC28589-39E4-4288-B162-97B959F8B843}"
28
+EndProject
29
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Universal", "..\..\node_modules\react-native-windows\JSI\Universal\JSI.Universal.vcxproj", "{A62D504A-16B8-41D2-9F19-E2E86019E5E4}"
30
+EndProject
31
+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}"
32
+EndProject
33
+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}"
34
+EndProject
35
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "..\..\node_modules\react-native-windows\Common\Common.vcxproj", "{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}"
36
+EndProject
37
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReactNative", "ReactNative", "{5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}"
38
+EndProject
39
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Shared", "..\..\node_modules\react-native-windows\Shared\Shared.vcxitems", "{2049DBE9-8D13-42C9-AE4B-413AE38FFFD0}"
40
+EndProject
41
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mso", "..\..\node_modules\react-native-windows\Mso\Mso.vcxitems", "{84E05BFA-CBAF-4F0D-BFB6-4CE85742A57E}"
42
+EndProject
43
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactNativeWebView", "..\..\windows\ReactNativeWebView\ReactNativeWebView.vcxproj", "{729D9AF8-CD9E-4427-9F6C-FB757E287729}"
44
+EndProject
45
+Global
46
+	GlobalSection(SharedMSBuildProjectFiles) = preSolution
47
+		..\..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{0cc28589-39e4-4288-b162-97b959f8b843}*SharedItemsImports = 9
48
+		..\..\node_modules\react-native-windows\Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9
49
+		..\..\node_modules\react-native-windows\Microsoft.ReactNative.SharedManaged\Microsoft.ReactNative.SharedManaged.projitems*{67a1076f-7790-4203-86ea-4402ccb5e782}*SharedItemsImports = 13
50
+		..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{729d9af8-cd9e-4427-9f6c-fb757e287729}*SharedItemsImports = 4
51
+		..\..\node_modules\react-native-windows\Mso\Mso.vcxitems*{84e05bfa-cbaf-4f0d-bfb6-4ce85742a57e}*SharedItemsImports = 9
52
+		..\..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{a62d504a-16b8-41d2-9f19-e2e86019e5e4}*SharedItemsImports = 4
53
+		..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{ac6c354f-8c80-47ea-9e40-996abe271843}*SharedItemsImports = 4
54
+		..\..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9
55
+		..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9
56
+		..\..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
57
+		..\..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
58
+		..\..\node_modules\react-native-windows\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
59
+		..\..\node_modules\react-native-windows\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
60
+	EndGlobalSection
61
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
62
+		Debug|ARM = Debug|ARM
63
+		Debug|ARM64 = Debug|ARM64
64
+		Debug|x64 = Debug|x64
65
+		Debug|x86 = Debug|x86
66
+		Release|ARM = Release|ARM
67
+		Release|ARM64 = Release|ARM64
68
+		Release|x64 = Release|x64
69
+		Release|x86 = Release|x86
70
+	EndGlobalSection
71
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
72
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|ARM.ActiveCfg = Debug|ARM
73
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|ARM.Build.0 = Debug|ARM
74
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|ARM.Deploy.0 = Debug|ARM
75
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|ARM64.ActiveCfg = Debug|ARM64
76
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|ARM64.Build.0 = Debug|ARM64
77
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|ARM64.Deploy.0 = Debug|ARM64
78
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|x64.ActiveCfg = Debug|x64
79
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|x64.Build.0 = Debug|x64
80
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|x64.Deploy.0 = Debug|x64
81
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|x86.ActiveCfg = Debug|Win32
82
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|x86.Build.0 = Debug|Win32
83
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Debug|x86.Deploy.0 = Debug|Win32
84
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|ARM.ActiveCfg = Release|ARM
85
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|ARM.Build.0 = Release|ARM
86
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|ARM.Deploy.0 = Release|ARM
87
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|ARM64.ActiveCfg = Release|ARM64
88
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|ARM64.Build.0 = Release|ARM64
89
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|ARM64.Deploy.0 = Release|ARM64
90
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|x64.ActiveCfg = Release|x64
91
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|x64.Build.0 = Release|x64
92
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|x64.Deploy.0 = Release|x64
93
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|x86.ActiveCfg = Release|Win32
94
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|x86.Build.0 = Release|Win32
95
+		{AC6C354F-8C80-47EA-9E40-996ABE271843}.Release|x86.Deploy.0 = Release|Win32
96
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.ActiveCfg = Debug|ARM
97
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.Build.0 = Debug|ARM
98
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.ActiveCfg = Debug|ARM64
99
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.Build.0 = Debug|ARM64
100
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.ActiveCfg = Debug|x64
101
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.Build.0 = Debug|x64
102
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.ActiveCfg = Debug|Win32
103
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.Build.0 = Debug|Win32
104
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.ActiveCfg = Release|ARM
105
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.Build.0 = Release|ARM
106
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM64.ActiveCfg = Release|ARM64
107
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM64.Build.0 = Release|ARM64
108
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.ActiveCfg = Release|x64
109
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.Build.0 = Release|x64
110
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.ActiveCfg = Release|Win32
111
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.Build.0 = Release|Win32
112
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.ActiveCfg = Debug|ARM
113
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.Build.0 = Debug|ARM
114
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.ActiveCfg = Debug|ARM64
115
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.Build.0 = Debug|ARM64
116
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.ActiveCfg = Debug|x64
117
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.Build.0 = Debug|x64
118
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.ActiveCfg = Debug|Win32
119
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.Build.0 = Debug|Win32
120
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.ActiveCfg = Release|ARM
121
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.Build.0 = Release|ARM
122
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM64.ActiveCfg = Release|ARM64
123
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM64.Build.0 = Release|ARM64
124
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.ActiveCfg = Release|x64
125
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.Build.0 = Release|x64
126
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.ActiveCfg = Release|Win32
127
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.Build.0 = Release|Win32
128
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.ActiveCfg = Debug|ARM
129
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.Build.0 = Debug|ARM
130
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM64.ActiveCfg = Debug|ARM64
131
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM64.Build.0 = Debug|ARM64
132
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.ActiveCfg = Debug|x64
133
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.Build.0 = Debug|x64
134
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.ActiveCfg = Debug|Win32
135
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.Build.0 = Debug|Win32
136
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.ActiveCfg = Release|ARM
137
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.Build.0 = Release|ARM
138
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM64.ActiveCfg = Release|ARM64
139
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM64.Build.0 = Release|ARM64
140
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.ActiveCfg = Release|x64
141
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.Build.0 = Release|x64
142
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.ActiveCfg = Release|Win32
143
+		{11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.Build.0 = Release|Win32
144
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM.ActiveCfg = Debug|ARM
145
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM.Build.0 = Debug|ARM
146
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM64.ActiveCfg = Debug|ARM64
147
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|ARM64.Build.0 = Debug|ARM64
148
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x64.ActiveCfg = Debug|x64
149
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x64.Build.0 = Debug|x64
150
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x86.ActiveCfg = Debug|Win32
151
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Debug|x86.Build.0 = Debug|Win32
152
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM.ActiveCfg = Release|ARM
153
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM.Build.0 = Release|ARM
154
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM64.ActiveCfg = Release|ARM64
155
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|ARM64.Build.0 = Release|ARM64
156
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x64.ActiveCfg = Release|x64
157
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x64.Build.0 = Release|x64
158
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x86.ActiveCfg = Release|Win32
159
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136}.Release|x86.Build.0 = Release|Win32
160
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.ActiveCfg = Debug|ARM
161
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.Build.0 = Debug|ARM
162
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM64.ActiveCfg = Debug|ARM64
163
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM64.Build.0 = Debug|ARM64
164
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.ActiveCfg = Debug|x64
165
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.Build.0 = Debug|x64
166
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.ActiveCfg = Debug|Win32
167
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.Build.0 = Debug|Win32
168
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.ActiveCfg = Release|ARM
169
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.Build.0 = Release|ARM
170
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM64.ActiveCfg = Release|ARM64
171
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM64.Build.0 = Release|ARM64
172
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.ActiveCfg = Release|x64
173
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.Build.0 = Release|x64
174
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.ActiveCfg = Release|Win32
175
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.Build.0 = Release|Win32
176
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM.ActiveCfg = Debug|ARM
177
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM.Build.0 = Debug|ARM
178
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.ActiveCfg = Debug|ARM64
179
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|ARM64.Build.0 = Debug|ARM64
180
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x64.ActiveCfg = Debug|x64
181
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x64.Build.0 = Debug|x64
182
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x86.ActiveCfg = Debug|Win32
183
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Debug|x86.Build.0 = Debug|Win32
184
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM.ActiveCfg = Release|ARM
185
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM.Build.0 = Release|ARM
186
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM64.ActiveCfg = Release|ARM64
187
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|ARM64.Build.0 = Release|ARM64
188
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.ActiveCfg = Release|x64
189
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x64.Build.0 = Release|x64
190
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.ActiveCfg = Release|Win32
191
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D}.Release|x86.Build.0 = Release|Win32
192
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|ARM.ActiveCfg = Debug|ARM
193
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|ARM.Build.0 = Debug|ARM
194
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|ARM64.ActiveCfg = Debug|Win32
195
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x64.ActiveCfg = Debug|x64
196
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x64.Build.0 = Debug|x64
197
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x86.ActiveCfg = Debug|Win32
198
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Debug|x86.Build.0 = Debug|Win32
199
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|ARM.ActiveCfg = Release|ARM
200
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|ARM.Build.0 = Release|ARM
201
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|ARM64.ActiveCfg = Release|Win32
202
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x64.ActiveCfg = Release|x64
203
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x64.Build.0 = Release|x64
204
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x86.ActiveCfg = Release|Win32
205
+		{729D9AF8-CD9E-4427-9F6C-FB757E287729}.Release|x86.Build.0 = Release|Win32
206
+	EndGlobalSection
207
+	GlobalSection(SolutionProperties) = preSolution
208
+		HideSolutionNode = FALSE
209
+	EndGlobalSection
210
+	GlobalSection(NestedProjects) = preSolution
211
+		{A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
212
+		{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
213
+		{11C084A3-A57C-4296-A679-CAC17B603144} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
214
+		{C38970C0-5FBF-4D69-90D8-CBAC225AE895} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
215
+		{F7D32BD0-2749-483E-9A0D-1635EF7E3136} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
216
+		{0CC28589-39E4-4288-B162-97B959F8B843} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
217
+		{A62D504A-16B8-41D2-9F19-E2E86019E5E4} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
218
+		{DA8B35B3-DA00-4B02-BDE6-6A397B3FD46B} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
219
+		{67A1076F-7790-4203-86EA-4402CCB5E782} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
220
+		{FCA38F3C-7C73-4C47-BE4E-32F77FA8538D} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
221
+		{2049DBE9-8D13-42C9-AE4B-413AE38FFFD0} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
222
+		{84E05BFA-CBAF-4F0D-BFB6-4CE85742A57E} = {5EA20F54-880A-49F3-99FA-4B3FE54E8AB1}
223
+	EndGlobalSection
224
+	GlobalSection(ExtensibilityGlobals) = postSolution
225
+		SolutionGuid = {D43FAD39-F619-437D-BB40-04A3982ACB6A}
226
+	EndGlobalSection
227
+EndGlobal

+ 47
- 0
example/windows/WebViewWindows/App.cpp Ver arquivo

@@ -0,0 +1,47 @@
1
+#include "pch.h"
2
+
3
+#include "App.h"
4
+#include "ReactPackageProvider.h"
5
+#include "winrt/ReactNativeWebView.h"
6
+
7
+
8
+using namespace winrt::WebViewWindows;
9
+using namespace winrt::WebViewWindows::implementation;
10
+
11
+/// <summary>
12
+/// Initializes the singleton application object.  This is the first line of
13
+/// authored code executed, and as such is the logical equivalent of main() or
14
+/// WinMain().
15
+/// </summary>
16
+App::App() noexcept
17
+{
18
+    MainComponentName(L"example");
19
+
20
+#if BUNDLE
21
+    JavaScriptBundleFile(L"index.windows");
22
+    InstanceSettings().UseWebDebugger(false);
23
+    InstanceSettings().UseLiveReload(false);
24
+#else
25
+    JavaScriptMainModuleName(L"example/index");
26
+    InstanceSettings().UseWebDebugger(true);
27
+    InstanceSettings().UseLiveReload(true);
28
+#endif
29
+
30
+#if _DEBUG
31
+    InstanceSettings().EnableDeveloperMenu(true);
32
+#else
33
+    InstanceSettings().EnableDeveloperMenu(false);
34
+#endif
35
+
36
+    PackageProviders().Append(make<ReactPackageProvider>()); // Includes all modules in this project
37
+    PackageProviders().Append(winrt::ReactNativeWebView::ReactPackageProvider());
38
+
39
+    InitializeComponent();
40
+
41
+    // This works around a cpp/winrt bug with composable/aggregable types tracked
42
+    // by 22116519
43
+    AddRef();
44
+    m_inner.as<::IUnknown>()->Release();
45
+}
46
+
47
+

+ 15
- 0
example/windows/WebViewWindows/App.h Ver arquivo

@@ -0,0 +1,15 @@
1
+#pragma once
2
+
3
+#include "App.xaml.g.h"
4
+
5
+
6
+
7
+namespace winrt::WebViewWindows::implementation
8
+{
9
+    struct App : AppT<App>
10
+    {
11
+        App() noexcept;
12
+    };
13
+} // namespace winrt::WebViewWindows::implementation
14
+
15
+

+ 3
- 0
example/windows/WebViewWindows/App.idl Ver arquivo

@@ -0,0 +1,3 @@
1
+namespace WebViewWindows
2
+{
3
+}

+ 10
- 0
example/windows/WebViewWindows/App.xaml Ver arquivo

@@ -0,0 +1,10 @@
1
+<react:ReactApplication
2
+    x:Class="WebViewWindows.App"
3
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5
+    xmlns:local="using:WebViewWindows"
6
+    xmlns:react="using:Microsoft.ReactNative">
7
+    <Application.Resources>
8
+        <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
9
+    </Application.Resources>
10
+</react:ReactApplication>

BIN
example/windows/WebViewWindows/Assets/LockScreenLogo.scale-200.png Ver arquivo


BIN
example/windows/WebViewWindows/Assets/SplashScreen.scale-200.png Ver arquivo


BIN
example/windows/WebViewWindows/Assets/Square150x150Logo.scale-200.png Ver arquivo


BIN
example/windows/WebViewWindows/Assets/Square44x44Logo.scale-200.png Ver arquivo


BIN
example/windows/WebViewWindows/Assets/Square44x44Logo.targetsize-24_altform-unplated.png Ver arquivo


BIN
example/windows/WebViewWindows/Assets/StoreLogo.png Ver arquivo


BIN
example/windows/WebViewWindows/Assets/Wide310x150Logo.scale-200.png Ver arquivo


+ 49
- 0
example/windows/WebViewWindows/Package.appxmanifest Ver arquivo

@@ -0,0 +1,49 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+
3
+<Package
4
+  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
5
+  xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
6
+  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
7
+  IgnorableNamespaces="uap mp">
8
+
9
+ <Identity
10
+    Name="6b4ef5e9-85c1-4006-87d7-77c61c62f84f"
11
+    Publisher="CN=kaigu"
12
+    Version="1.0.0.0" />
13
+
14
+  <mp:PhoneIdentity PhoneProductId="6b4ef5e9-85c1-4006-87d7-77c61c62f84f" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
15
+
16
+  <Properties>
17
+    <DisplayName>WebViewWindows</DisplayName>
18
+    <PublisherDisplayName>kaigu</PublisherDisplayName>
19
+    <Logo>Assets\StoreLogo.png</Logo>
20
+  </Properties>
21
+
22
+  <Dependencies>
23
+    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
24
+  </Dependencies>
25
+
26
+  <Resources>
27
+    <Resource Language="x-generate"/>
28
+  </Resources>
29
+
30
+  <Applications>
31
+    <Application Id="App"
32
+      Executable="$targetnametoken$.exe"
33
+      EntryPoint="WebViewWindows.App">
34
+      <uap:VisualElements
35
+        DisplayName="WebViewWindows"
36
+        Square150x150Logo="Assets\Square150x150Logo.png"
37
+        Square44x44Logo="Assets\Square44x44Logo.png"
38
+        Description="WebViewWindows"
39
+        BackgroundColor="transparent">
40
+        <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
41
+        <uap:SplashScreen Image="Assets\SplashScreen.png" />
42
+      </uap:VisualElements>
43
+    </Application>
44
+  </Applications>
45
+
46
+  <Capabilities>
47
+    <Capability Name="internetClient" />
48
+  </Capabilities>
49
+</Package>

+ 16
- 0
example/windows/WebViewWindows/PropertySheet.props Ver arquivo

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

+ 2
- 0
example/windows/WebViewWindows/ReactAssets/.gitignore Ver arquivo

@@ -0,0 +1,2 @@
1
+*
2
+!.gitignore

+ 20
- 0
example/windows/WebViewWindows/ReactPackageProvider.cpp Ver arquivo

@@ -0,0 +1,20 @@
1
+#include "pch.h"
2
+#include "ReactPackageProvider.h"
3
+
4
+#include "NativeModules.h"
5
+
6
+
7
+
8
+using namespace winrt::Microsoft::ReactNative;
9
+
10
+namespace winrt::WebViewWindows::implementation
11
+{
12
+
13
+void ReactPackageProvider::CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept
14
+{
15
+    AddAttributedModules(packageBuilder);
16
+}
17
+
18
+} // namespace winrt::WebViewWindows::implementation
19
+
20
+

+ 20
- 0
example/windows/WebViewWindows/ReactPackageProvider.h Ver arquivo

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

+ 180
- 0
example/windows/WebViewWindows/WebViewWindows.vcxproj Ver arquivo

@@ -0,0 +1,180 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" DefaultTargets="Build" 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>{ac6c354f-8c80-47ea-9e40-996abe271843}</ProjectGuid>
9
+    <ProjectName>WebViewWindows</ProjectName>
10
+    <RootNamespace>WebViewWindows</RootNamespace>
11
+    <DefaultLanguage>en-US</DefaultLanguage>
12
+    <MinimumVisualStudioVersion>15.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
+    <PackageCertificateKeyFile>WebViewWindows_TemporaryKey.pfx</PackageCertificateKeyFile>
19
+    <PackageCertificateThumbprint>82A0D300B0912A62746FFB3E6E04F88985BC2798</PackageCertificateThumbprint>
20
+    <PackageCertificatePassword>password</PackageCertificatePassword>
21
+  </PropertyGroup>
22
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
23
+  <ItemGroup Label="ProjectConfigurations">
24
+    <ProjectConfiguration Include="Debug|ARM">
25
+      <Configuration>Debug</Configuration>
26
+      <Platform>ARM</Platform>
27
+    </ProjectConfiguration>
28
+    <ProjectConfiguration Include="Debug|ARM64">
29
+      <Configuration>Debug</Configuration>
30
+      <Platform>ARM64</Platform>
31
+    </ProjectConfiguration>
32
+    <ProjectConfiguration Include="Debug|Win32">
33
+      <Configuration>Debug</Configuration>
34
+      <Platform>Win32</Platform>
35
+    </ProjectConfiguration>
36
+    <ProjectConfiguration Include="Debug|x64">
37
+      <Configuration>Debug</Configuration>
38
+      <Platform>x64</Platform>
39
+    </ProjectConfiguration>
40
+    <ProjectConfiguration Include="Release|ARM">
41
+      <Configuration>Release</Configuration>
42
+      <Platform>ARM</Platform>
43
+    </ProjectConfiguration>
44
+    <ProjectConfiguration Include="Release|ARM64">
45
+      <Configuration>Release</Configuration>
46
+      <Platform>ARM64</Platform>
47
+    </ProjectConfiguration>
48
+    <ProjectConfiguration Include="Release|Win32">
49
+      <Configuration>Release</Configuration>
50
+      <Platform>Win32</Platform>
51
+    </ProjectConfiguration>
52
+    <ProjectConfiguration Include="Release|x64">
53
+      <Configuration>Release</Configuration>
54
+      <Platform>x64</Platform>
55
+    </ProjectConfiguration>
56
+  </ItemGroup>
57
+  <PropertyGroup Label="Configuration">
58
+    <ConfigurationType>Application</ConfigurationType>
59
+    <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
60
+    <CharacterSet>Unicode</CharacterSet>
61
+  </PropertyGroup>
62
+  <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
63
+    <UseDebugLibraries>true</UseDebugLibraries>
64
+    <LinkIncremental>true</LinkIncremental>
65
+  </PropertyGroup>
66
+  <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
67
+    <UseDebugLibraries>false</UseDebugLibraries>
68
+    <WholeProgramOptimization>true</WholeProgramOptimization>
69
+    <LinkIncremental>false</LinkIncremental>
70
+  </PropertyGroup>
71
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
72
+  <ImportGroup Label="ExtensionSettings">
73
+  </ImportGroup>
74
+  <ImportGroup Label="Shared">
75
+    <Import Project="..\..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems" Label="Shared" />
76
+  </ImportGroup>
77
+  <ImportGroup Label="PropertySheets">
78
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
79
+  </ImportGroup>
80
+  <ImportGroup Label="PropertySheets">
81
+    <Import Project="PropertySheet.props" />
82
+  </ImportGroup>
83
+  <PropertyGroup Label="UserMacros" />
84
+  <ItemDefinitionGroup>
85
+    <ClCompile>
86
+      <PrecompiledHeader>Use</PrecompiledHeader>
87
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
88
+      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
89
+      <WarningLevel>Level4</WarningLevel>
90
+      <AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
91
+      <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
92
+    </ClCompile>
93
+  </ItemDefinitionGroup>
94
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
95
+    <ClCompile>
96
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
97
+    </ClCompile>
98
+  </ItemDefinitionGroup>
99
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
100
+    <ClCompile>
101
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
102
+    </ClCompile>
103
+  </ItemDefinitionGroup>
104
+  <ItemGroup>
105
+    <ClInclude Include="ReactPackageProvider.h" />
106
+    <ClInclude Include="pch.h" />
107
+    <ClInclude Include="App.h">
108
+      <DependentUpon>App.xaml</DependentUpon>
109
+    </ClInclude>
110
+  </ItemGroup>
111
+  <ItemGroup>
112
+    <ApplicationDefinition Include="App.xaml">
113
+      <SubType>Designer</SubType>
114
+    </ApplicationDefinition>
115
+  </ItemGroup>
116
+  <ItemGroup>
117
+    <AppxManifest Include="Package.appxmanifest">
118
+      <SubType>Designer</SubType>
119
+    </AppxManifest>
120
+  </ItemGroup>
121
+  <ItemGroup>
122
+    <Image Include="Assets\LockScreenLogo.scale-200.png" />
123
+    <Image Include="Assets\SplashScreen.scale-200.png" />
124
+    <Image Include="Assets\Square150x150Logo.scale-200.png" />
125
+    <Image Include="Assets\Square44x44Logo.scale-200.png" />
126
+    <Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
127
+    <Image Include="Assets\StoreLogo.png" />
128
+    <Image Include="Assets\Wide310x150Logo.scale-200.png" />
129
+  </ItemGroup>
130
+  <ItemGroup>
131
+    <ClCompile Include="ReactPackageProvider.cpp" />
132
+    <ClCompile Include="pch.cpp">
133
+      <PrecompiledHeader>Create</PrecompiledHeader>
134
+    </ClCompile>
135
+    <ClCompile Include="App.cpp">
136
+      <DependentUpon>App.xaml</DependentUpon>
137
+    </ClCompile>
138
+    <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
139
+  </ItemGroup>
140
+  <ItemGroup>
141
+    <Midl Include="App.idl">
142
+      <DependentUpon>App.xaml</DependentUpon>
143
+    </Midl>
144
+  </ItemGroup>
145
+  <ItemGroup>
146
+    <None Include="packages.config" />
147
+    <None Include="PropertySheet.props" />
148
+    <Text Include="readme.txt">
149
+      <DeploymentContent>false</DeploymentContent>
150
+    </Text>
151
+  </ItemGroup>
152
+  <ItemGroup>
153
+    <ProjectReference Include="..\..\..\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj">
154
+      <Project>{f7d32bd0-2749-483e-9a0d-1635ef7e3136}</Project>
155
+    </ProjectReference>
156
+    <ProjectReference Include="..\..\..\windows\ReactNativeWebView\ReactNativeWebView.vcxproj">
157
+      <Project>{729d9af8-cd9e-4427-9f6c-fb757e287729}</Project>
158
+    </ProjectReference>
159
+  </ItemGroup>
160
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
161
+  <PropertyGroup>
162
+    <BundleCommand>
163
+      cd $(SolutionDir)..
164
+      react-native bundle --platform windows --entry-file example/index.js --bundle-output windows/$(SolutionName)/Bundle/index.windows.bundle --assets-dest windows/$(SolutionName)/Bundle
165
+    </BundleCommand>
166
+  </PropertyGroup>
167
+  <Import Project="..\..\..\node_modules\react-native-windows\PropertySheets\Bundle.Cpp.targets" />
168
+  <ImportGroup Label="ExtensionTargets">
169
+    <Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
170
+    <Import Project="$(SolutionDir)packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets')" />
171
+  </ImportGroup>
172
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
173
+    <PropertyGroup>
174
+      <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>
175
+    </PropertyGroup>
176
+    <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'))" />
177
+    <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'))" />
178
+    <Error Condition="!Exists('$(SolutionDir)packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets'))" />
179
+  </Target>
180
+</Project>

+ 58
- 0
example/windows/WebViewWindows/WebViewWindows.vcxproj.filters Ver arquivo

@@ -0,0 +1,58 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <ItemGroup>
4
+    <ApplicationDefinition Include="App.xaml" />
5
+  </ItemGroup>
6
+  <ItemGroup>
7
+    <Midl Include="App.idl" />
8
+  </ItemGroup>
9
+  <ItemGroup>
10
+    <ClCompile Include="pch.cpp" />
11
+    <ClCompile Include="App.cpp" />
12
+    <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
13
+    <ClCompile Include="ReactPackageProvider.cpp" />
14
+  </ItemGroup>
15
+  <ItemGroup>
16
+    <ClInclude Include="pch.h" />
17
+    <ClInclude Include="App.h" />
18
+    <ClInclude Include="ReactPackageProvider.h" />
19
+  </ItemGroup>
20
+  <ItemGroup>
21
+    <Image Include="Assets\Wide310x150Logo.scale-200.png">
22
+      <Filter>Assets</Filter>
23
+    </Image>
24
+    <Image Include="Assets\StoreLogo.png">
25
+      <Filter>Assets</Filter>
26
+    </Image>
27
+    <Image Include="Assets\Square150x150Logo.scale-200.png">
28
+      <Filter>Assets</Filter>
29
+    </Image>
30
+    <Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png">
31
+      <Filter>Assets</Filter>
32
+    </Image>
33
+    <Image Include="Assets\Square44x44Logo.scale-200.png">
34
+      <Filter>Assets</Filter>
35
+    </Image>
36
+    <Image Include="Assets\SplashScreen.scale-200.png">
37
+      <Filter>Assets</Filter>
38
+    </Image>
39
+    <Image Include="Assets\LockScreenLogo.scale-200.png">
40
+      <Filter>Assets</Filter>
41
+    </Image>
42
+  </ItemGroup>
43
+  <ItemGroup>
44
+    <AppxManifest Include="Package.appxmanifest" />
45
+  </ItemGroup>
46
+  <ItemGroup>
47
+    <Filter Include="Assets">
48
+      <UniqueIdentifier>{e48dc53e-40b1-40cb-970a-f89935452892}</UniqueIdentifier>
49
+    </Filter>
50
+  </ItemGroup>
51
+  <ItemGroup>
52
+    <None Include="PropertySheet.props" />
53
+    <None Include="packages.config" />
54
+  </ItemGroup>
55
+  <ItemGroup>
56
+    <Text Include="readme.txt" />
57
+  </ItemGroup>
58
+</Project>

BIN
example/windows/WebViewWindows/WebViewWindows_TemporaryKey.pfx Ver arquivo


+ 5
- 0
example/windows/WebViewWindows/packages.config Ver arquivo

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

+ 1
- 0
example/windows/WebViewWindows/pch.cpp Ver arquivo

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

+ 25
- 0
example/windows/WebViewWindows/pch.h Ver arquivo

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

+ 48
- 0
metro.config.windows.js Ver arquivo

@@ -0,0 +1,48 @@
1
+/**
2
+ * Metro configuration for React Native
3
+ * https://github.com/facebook/react-native
4
+ *
5
+ * @format
6
+ */
7
+const fs = require('fs');
8
+const path = require('path');
9
+const blacklist = require('metro-config/src/defaults/blacklist');
10
+
11
+const rnPath = fs.realpathSync(
12
+  path.resolve(require.resolve('react-native/package.json'), '..'),
13
+);
14
+const rnwPath = fs.realpathSync(
15
+  path.resolve(require.resolve('react-native-windows/package.json'), '..'),
16
+);
17
+
18
+module.exports = {
19
+  resolver: {
20
+    extraNodeModules: {
21
+      // Redirect react-native to react-native-windows
22
+      'react-native': rnwPath,
23
+      'react-native-windows': rnwPath,
24
+    },
25
+    // Include the macos platform in addition to the defaults because the fork includes macos, but doesn't declare it
26
+    platforms: ['ios', 'android', 'windesktop', 'windows', 'web', 'macos'],
27
+    // Since there are multiple copies of react-native, we need to ensure that metro only sees one of them
28
+    // This should go in RN 0.61 when haste is removed
29
+    blacklistRE: blacklist([
30
+      new RegExp(
31
+        `${(path.resolve(rnPath) + path.sep).replace(/[/\\]/g, '/')}.*`,
32
+      ),
33
+
34
+      // This stops "react-native run-windows" from causing the metro server to crash if its already running
35
+      new RegExp(
36
+        `${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
37
+      ),
38
+    ]),
39
+  },
40
+  transformer: {
41
+    getTransformOptions: async () => ({
42
+      transform: {
43
+        experimentalImportSupport: false,
44
+        inlineRequires: false,
45
+      },
46
+    }),
47
+  },
48
+};

+ 86
- 80
package.json Ver arquivo

@@ -1,80 +1,86 @@
1
-{
2
-  "name": "react-native-webview",
3
-  "description": "React Native WebView component for iOS, Android, and macOS",
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": "8.1.2",
12
-  "homepage": "https://github.com/react-native-community/react-native-webview#readme",
13
-  "scripts": {
14
-    "start": "node node_modules/react-native/local-cli/cli.js start",
15
-    "start:android": "react-native run-android --root example/",
16
-    "start:ios": "react-native run-ios --project-path example/ios --scheme example",
17
-    "start:macos": "node node_modules/react-native-macos/local-cli/cli.js start --use-react-native-macos",
18
-    "ci": "CI=true && yarn lint && yarn test",
19
-    "ci:publish": "yarn semantic-release",
20
-    "lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx",
21
-    "build": "yarn tsc",
22
-    "prepare": "yarn build",
23
-    "test": "yarn jest"
24
-  },
25
-  "rn-docs": {
26
-    "title": "Webview",
27
-    "type": "Component"
28
-  },
29
-  "peerDependencies": {
30
-    "react": "^16.9",
31
-    "react-native": ">=0.60 <0.62"
32
-  },
33
-  "dependencies": {
34
-    "escape-string-regexp": "2.0.0",
35
-    "invariant": "2.2.4"
36
-  },
37
-  "devDependencies": {
38
-    "@babel/core": "7.4.5",
39
-    "@babel/runtime": "7.4.5",
40
-    "@react-native-community/cli-platform-ios": "^3.0.0",
41
-    "@react-native-community/cli-platform-android": "^3.0.0",
42
-    "@semantic-release/git": "7.0.16",
43
-    "@types/invariant": "^2.2.30",
44
-    "@types/jest": "24.0.18",
45
-    "@types/react": "16.8.8",
46
-    "@types/react-native": "0.60.11",
47
-    "@typescript-eslint/eslint-plugin": "2.1.0",
48
-    "@typescript-eslint/parser": "2.1.0",
49
-    "babel-eslint": "10.0.3",
50
-    "babel-jest": "24.8.0",
51
-    "babel-plugin-module-resolver": "3.1.3",
52
-    "eslint": "6.3.0",
53
-    "eslint-config-airbnb": "18.0.1",
54
-    "eslint-config-prettier": "6.2.0",
55
-    "eslint-plugin-import": "2.18.2",
56
-    "eslint-plugin-jsx-a11y": "6.2.3",
57
-    "eslint-plugin-react": "7.14.3",
58
-    "eslint-plugin-react-native": "3.7.0",
59
-    "jest": "24.9.0",
60
-    "metro-react-native-babel-preset": "0.54.1",
61
-    "react": "16.9.0",
62
-    "react-native": "0.61.5",
63
-    "react-native-macos": "0.60.0-microsoft.49",
64
-    "semantic-release": "15.13.24",
65
-    "typescript": "3.6.2"
66
-  },
67
-  "repository": {
68
-    "type": "git",
69
-    "url": "https://github.com/react-native-community/react-native-webview.git"
70
-  },
71
-  "files": [
72
-    "android",
73
-    "ios",
74
-    "macos",
75
-    "lib",
76
-    "index.js",
77
-    "index.d.ts",
78
-    "react-native-webview.podspec"
79
-  ]
80
-}
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": "8.1.2",
12
+  "homepage": "https://github.com/react-native-community/react-native-webview#readme",
13
+  "scripts": {
14
+    "start": "node node_modules/react-native/local-cli/cli.js start",
15
+    "start:android": "react-native run-android --root example/",
16
+    "start:ios": "react-native run-ios --project-path example/ios --scheme example",
17
+    "start:macos": "node node_modules/react-native-macos/local-cli/cli.js start --use-react-native-macos",
18
+    "start:windows": "react-native start --use-react-native-windows",
19
+    "ci": "CI=true && yarn lint && yarn test",
20
+    "ci:publish": "yarn semantic-release",
21
+    "lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx",
22
+    "build": "yarn tsc",
23
+    "prepare": "yarn build",
24
+    "test": "yarn jest"
25
+  },
26
+  "rn-docs": {
27
+    "title": "Webview",
28
+    "type": "Component"
29
+  },
30
+  "peerDependencies": {
31
+    "react": "^16.9",
32
+    "react-native": ">=0.60 <0.62",
33
+    "react-native-windows": "0.61.0-beta.58"
34
+  },
35
+  "dependencies": {
36
+    "escape-string-regexp": "2.0.0",
37
+    "invariant": "2.2.4",
38
+    "rnpm-plugin-windows": "^0.5.1-0"
39
+  },
40
+  "devDependencies": {
41
+    "@babel/core": "7.4.5",
42
+    "@babel/runtime": "7.4.5",
43
+    "@react-native-community/cli": "^3.2.0",
44
+    "@react-native-community/cli-platform-android": "^3.0.0",
45
+    "@react-native-community/cli-platform-ios": "^3.0.0",
46
+    "@semantic-release/git": "7.0.16",
47
+    "@types/invariant": "^2.2.30",
48
+    "@types/jest": "24.0.18",
49
+    "@types/react": "16.8.8",
50
+    "@types/react-native": "0.60.11",
51
+    "@typescript-eslint/eslint-plugin": "2.1.0",
52
+    "@typescript-eslint/parser": "2.1.0",
53
+    "babel-eslint": "10.0.3",
54
+    "babel-jest": "24.8.0",
55
+    "babel-plugin-module-resolver": "3.1.3",
56
+    "eslint": "6.3.0",
57
+    "eslint-config-airbnb": "18.0.1",
58
+    "eslint-config-prettier": "6.2.0",
59
+    "eslint-plugin-import": "2.18.2",
60
+    "eslint-plugin-jsx-a11y": "6.2.3",
61
+    "eslint-plugin-react": "7.14.3",
62
+    "eslint-plugin-react-native": "3.7.0",
63
+    "jest": "24.9.0",
64
+    "metro-react-native-babel-preset": "0.54.1",
65
+    "react": "16.9.0",
66
+    "react-native": "0.61.5",
67
+    "react-native-macos": "0.60.0-microsoft.49",
68
+    "react-native-windows": "0.61.0-beta.58",
69
+    "semantic-release": "15.13.24",
70
+    "typescript": "3.6.2"
71
+  },
72
+  "repository": {
73
+    "type": "git",
74
+    "url": "https://github.com/react-native-community/react-native-webview.git"
75
+  },
76
+  "files": [
77
+    "android",
78
+    "ios",
79
+    "macos",
80
+    "windows",
81
+    "lib",
82
+    "index.js",
83
+    "index.d.ts",
84
+    "react-native-webview.podspec"
85
+  ]
86
+}

+ 8
- 0
react-native.config.js Ver arquivo

@@ -16,6 +16,7 @@
16 16
 'use strict';
17 17
 
18 18
 const macSwitch = '--use-react-native-macos';
19
+const windowsSwitch = '--use-react-native-windows';
19 20
 
20 21
 if (process.argv.includes(macSwitch)) {
21 22
   process.argv = process.argv.filter(arg => arg !== macSwitch);
@@ -23,4 +24,11 @@ if (process.argv.includes(macSwitch)) {
23 24
   module.exports = {
24 25
     reactNativePath: 'node_modules/react-native-macos',
25 26
   };
27
+}
28
+else if (process.argv.includes(windowsSwitch)) {
29
+  process.argv = process.argv.filter(arg => arg !== windowsSwitch);
30
+  process.argv.push('--config=metro.config.windows.js');
31
+  module.exports = {
32
+    reactNativePath: 'node_modules/react-native-windows',
33
+  };
26 34
 }

+ 258
- 0
src/WebView.windows.tsx Ver arquivo

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

+ 13
- 0
src/WebViewTypes.ts Ver arquivo

@@ -29,6 +29,7 @@ interface RNCWebViewUIManager<Commands extends string> extends UIManagerStatic {
29 29
 export type RNCWebViewUIManagerAndroid = RNCWebViewUIManager<WebViewCommands | AndroidWebViewCommands>
30 30
 export type RNCWebViewUIManagerIOS = RNCWebViewUIManager<WebViewCommands>
31 31
 export type RNCWebViewUIManagerMacOS = RNCWebViewUIManager<WebViewCommands>
32
+export type RNCWebViewUIManagerWindows = RNCWebViewUIManager<WebViewCommands>
32 33
 
33 34
 
34 35
 type WebViewState = 'IDLE' | 'LOADING' | 'ERROR';
@@ -73,6 +74,14 @@ declare const NativeWebViewAndroidBase: Constructor<NativeMethodsMixin> &
73 74
   typeof NativeWebViewAndroidComponent;
74 75
 export class NativeWebViewAndroid extends NativeWebViewAndroidBase {}
75 76
 
77
+// eslint-disable-next-line react/prefer-stateless-function
78
+declare class NativeWebViewWindowsComponent extends Component<
79
+  WindowsNativeWebViewProps
80
+> {}
81
+declare const NativeWebViewWindowsBase: Constructor<NativeMethodsMixin> &
82
+  typeof NativeWebViewWindowsComponent;
83
+export class NativeWebViewWindows extends NativeWebViewWindowsBase {}
84
+
76 85
 export interface ContentInsetProp {
77 86
   top?: number;
78 87
   left?: number;
@@ -309,6 +318,10 @@ export interface MacOSNativeWebViewProps extends CommonNativeWebViewProps {
309 318
   onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void;
310 319
 }
311 320
 
321
+export interface WindowsNativeWebViewProps extends CommonNativeWebViewProps {
322
+  testID?: string
323
+}
324
+
312 325
 export interface IOSWebViewProps extends WebViewSharedProps {
313 326
   /**
314 327
    * Does not store any data within the lifetime of the WebView.

+ 353
- 0
windows/.gitignore Ver arquivo

@@ -0,0 +1,353 @@
1
+## Ignore Visual Studio temporary files, build results, and
2
+## files generated by popular Visual Studio add-ons.
3
+##
4
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5
+
6
+# User-specific files
7
+*.rsuser
8
+*.suo
9
+*.user
10
+*.userosscache
11
+*.sln.docstates
12
+
13
+# User-specific files (MonoDevelop/Xamarin Studio)
14
+*.userprefs
15
+
16
+# Mono auto generated files
17
+mono_crash.*
18
+
19
+# Build results
20
+[Dd]ebug/
21
+[Dd]ebugPublic/
22
+[Rr]elease/
23
+[Rr]eleases/
24
+x64/
25
+x86/
26
+[Aa][Rr][Mm]/
27
+[Aa][Rr][Mm]64/
28
+bld/
29
+[Bb]in/
30
+[Oo]bj/
31
+[Ll]og/
32
+[Ll]ogs/
33
+
34
+# Visual Studio 2015/2017 cache/options directory
35
+.vs/
36
+# Uncomment if you have tasks that create the project's static files in wwwroot
37
+#wwwroot/
38
+
39
+# Visual Studio 2017 auto generated files
40
+Generated\ Files/
41
+
42
+# MSTest test Results
43
+[Tt]est[Rr]esult*/
44
+[Bb]uild[Ll]og.*
45
+
46
+# NUnit
47
+*.VisualState.xml
48
+TestResult.xml
49
+nunit-*.xml
50
+
51
+# Build Results of an ATL Project
52
+[Dd]ebugPS/
53
+[Rr]eleasePS/
54
+dlldata.c
55
+
56
+# Benchmark Results
57
+BenchmarkDotNet.Artifacts/
58
+
59
+# .NET Core
60
+project.lock.json
61
+project.fragment.lock.json
62
+artifacts/
63
+
64
+# StyleCop
65
+StyleCopReport.xml
66
+
67
+# Files built by Visual Studio
68
+*_i.c
69
+*_p.c
70
+*_h.h
71
+*.ilk
72
+*.meta
73
+*.obj
74
+*.iobj
75
+*.pch
76
+*.pdb
77
+*.ipdb
78
+*.pgc
79
+*.pgd
80
+*.rsp
81
+*.sbr
82
+*.tlb
83
+*.tli
84
+*.tlh
85
+*.tmp
86
+*.tmp_proj
87
+*_wpftmp.csproj
88
+*.log
89
+*.vspscc
90
+*.vssscc
91
+.builds
92
+*.pidb
93
+*.svclog
94
+*.scc
95
+
96
+# Chutzpah Test files
97
+_Chutzpah*
98
+
99
+# Visual C++ cache files
100
+ipch/
101
+*.aps
102
+*.ncb
103
+*.opendb
104
+*.opensdf
105
+*.sdf
106
+*.cachefile
107
+*.VC.db
108
+*.VC.VC.opendb
109
+
110
+# Visual Studio profiler
111
+*.psess
112
+*.vsp
113
+*.vspx
114
+*.sap
115
+
116
+# Visual Studio Trace Files
117
+*.e2e
118
+
119
+# TFS 2012 Local Workspace
120
+$tf/
121
+
122
+# Guidance Automation Toolkit
123
+*.gpState
124
+
125
+# ReSharper is a .NET coding add-in
126
+_ReSharper*/
127
+*.[Rr]e[Ss]harper
128
+*.DotSettings.user
129
+
130
+# TeamCity is a build add-in
131
+_TeamCity*
132
+
133
+# DotCover is a Code Coverage Tool
134
+*.dotCover
135
+
136
+# AxoCover is a Code Coverage Tool
137
+.axoCover/*
138
+!.axoCover/settings.json
139
+
140
+# Coverlet is a free, cross platform Code Coverage Tool
141
+coverage*[.json, .xml, .info]
142
+
143
+# Visual Studio code coverage results
144
+*.coverage
145
+*.coveragexml
146
+
147
+# NCrunch
148
+_NCrunch_*
149
+.*crunch*.local.xml
150
+nCrunchTemp_*
151
+
152
+# MightyMoose
153
+*.mm.*
154
+AutoTest.Net/
155
+
156
+# Web workbench (sass)
157
+.sass-cache/
158
+
159
+# Installshield output folder
160
+[Ee]xpress/
161
+
162
+# DocProject is a documentation generator add-in
163
+DocProject/buildhelp/
164
+DocProject/Help/*.HxT
165
+DocProject/Help/*.HxC
166
+DocProject/Help/*.hhc
167
+DocProject/Help/*.hhk
168
+DocProject/Help/*.hhp
169
+DocProject/Help/Html2
170
+DocProject/Help/html
171
+
172
+# Click-Once directory
173
+publish/
174
+
175
+# Publish Web Output
176
+*.[Pp]ublish.xml
177
+*.azurePubxml
178
+# Note: Comment the next line if you want to checkin your web deploy settings,
179
+# but database connection strings (with potential passwords) will be unencrypted
180
+*.pubxml
181
+*.publishproj
182
+
183
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
184
+# checkin your Azure Web App publish settings, but sensitive information contained
185
+# in these scripts will be unencrypted
186
+PublishScripts/
187
+
188
+# NuGet Packages
189
+*.nupkg
190
+# NuGet Symbol Packages
191
+*.snupkg
192
+# The packages folder can be ignored because of Package Restore
193
+**/[Pp]ackages/*
194
+# except build/, which is used as an MSBuild target.
195
+!**/[Pp]ackages/build/
196
+# Uncomment if necessary however generally it will be regenerated when needed
197
+#!**/[Pp]ackages/repositories.config
198
+# NuGet v3's project.json files produces more ignorable files
199
+*.nuget.props
200
+*.nuget.targets
201
+
202
+# Microsoft Azure Build Output
203
+csx/
204
+*.build.csdef
205
+
206
+# Microsoft Azure Emulator
207
+ecf/
208
+rcf/
209
+
210
+# Windows Store app package directories and files
211
+AppPackages/
212
+BundleArtifacts/
213
+Package.StoreAssociation.xml
214
+_pkginfo.txt
215
+*.appx
216
+*.appxbundle
217
+*.appxupload
218
+
219
+# Visual Studio cache files
220
+# files ending in .cache can be ignored
221
+*.[Cc]ache
222
+# but keep track of directories ending in .cache
223
+!?*.[Cc]ache/
224
+
225
+# Others
226
+ClientBin/
227
+~$*
228
+*~
229
+*.dbmdl
230
+*.dbproj.schemaview
231
+*.jfm
232
+*.pfx
233
+*.publishsettings
234
+orleans.codegen.cs
235
+
236
+# Including strong name files can present a security risk
237
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
238
+#*.snk
239
+
240
+# Since there are multiple workflows, uncomment next line to ignore bower_components
241
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
242
+#bower_components/
243
+
244
+# RIA/Silverlight projects
245
+Generated_Code/
246
+
247
+# Backup & report files from converting an old project file
248
+# to a newer Visual Studio version. Backup files are not needed,
249
+# because we have git ;-)
250
+_UpgradeReport_Files/
251
+Backup*/
252
+UpgradeLog*.XML
253
+UpgradeLog*.htm
254
+ServiceFabricBackup/
255
+*.rptproj.bak
256
+
257
+# SQL Server files
258
+*.mdf
259
+*.ldf
260
+*.ndf
261
+
262
+# Business Intelligence projects
263
+*.rdl.data
264
+*.bim.layout
265
+*.bim_*.settings
266
+*.rptproj.rsuser
267
+*- [Bb]ackup.rdl
268
+*- [Bb]ackup ([0-9]).rdl
269
+*- [Bb]ackup ([0-9][0-9]).rdl
270
+
271
+# Microsoft Fakes
272
+FakesAssemblies/
273
+
274
+# GhostDoc plugin setting file
275
+*.GhostDoc.xml
276
+
277
+# Node.js Tools for Visual Studio
278
+.ntvs_analysis.dat
279
+node_modules/
280
+
281
+# Visual Studio 6 build log
282
+*.plg
283
+
284
+# Visual Studio 6 workspace options file
285
+*.opt
286
+
287
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
288
+*.vbw
289
+
290
+# Visual Studio LightSwitch build output
291
+**/*.HTMLClient/GeneratedArtifacts
292
+**/*.DesktopClient/GeneratedArtifacts
293
+**/*.DesktopClient/ModelManifest.xml
294
+**/*.Server/GeneratedArtifacts
295
+**/*.Server/ModelManifest.xml
296
+_Pvt_Extensions
297
+
298
+# Paket dependency manager
299
+.paket/paket.exe
300
+paket-files/
301
+
302
+# FAKE - F# Make
303
+.fake/
304
+
305
+# CodeRush personal settings
306
+.cr/personal
307
+
308
+# Python Tools for Visual Studio (PTVS)
309
+__pycache__/
310
+*.pyc
311
+
312
+# Cake - Uncomment if you are using it
313
+# tools/**
314
+# !tools/packages.config
315
+
316
+# Tabs Studio
317
+*.tss
318
+
319
+# Telerik's JustMock configuration file
320
+*.jmconfig
321
+
322
+# BizTalk build output
323
+*.btp.cs
324
+*.btm.cs
325
+*.odx.cs
326
+*.xsd.cs
327
+
328
+# OpenCover UI analysis results
329
+OpenCover/
330
+
331
+# Azure Stream Analytics local run output
332
+ASALocalRun/
333
+
334
+# MSBuild Binary and Structured Log
335
+*.binlog
336
+
337
+# NVidia Nsight GPU debugger configuration file
338
+*.nvuser
339
+
340
+# MFractors (Xamarin productivity tool) working folder
341
+.mfractor/
342
+
343
+# Local History for Visual Studio
344
+.localhistory/
345
+
346
+# BeatPulse healthcheck temp database
347
+healthchecksdb
348
+
349
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
350
+MigrationBackup/
351
+
352
+# Ionide (cross platform F# VS Code tools) working folder
353
+.ionide/

+ 204
- 0
windows/ReactNativeWebView.sln Ver arquivo

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

+ 16
- 0
windows/ReactNativeWebView/PropertySheet.props Ver arquivo

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

+ 3
- 0
windows/ReactNativeWebView/ReactNativeWebView.def Ver arquivo

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

+ 33
- 0
windows/ReactNativeWebView/ReactNativeWebView.filters Ver arquivo

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

+ 162
- 0
windows/ReactNativeWebView/ReactNativeWebView.vcxproj Ver arquivo

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

+ 17
- 0
windows/ReactNativeWebView/ReactPackageProvider.cpp Ver arquivo

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

+ 20
- 0
windows/ReactNativeWebView/ReactPackageProvider.h Ver arquivo

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

+ 7
- 0
windows/ReactNativeWebView/ReactPackageProvider.idl Ver arquivo

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

+ 144
- 0
windows/ReactNativeWebView/ReactWebView.cpp Ver arquivo

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

+ 36
- 0
windows/ReactNativeWebView/ReactWebView.h Ver arquivo

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

+ 7
- 0
windows/ReactNativeWebView/ReactWebView.idl Ver arquivo

@@ -0,0 +1,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
+    };
7
+} // namespace ReactNativeWebView

+ 144
- 0
windows/ReactNativeWebView/ReactWebViewManager.cpp Ver arquivo

@@ -0,0 +1,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
+                        // non-uri sources not yet supported
62
+                        if (uriString.length() == 0) {
63
+                            continue;
64
+                        }
65
+
66
+                        bool isPackagerAsset = false;
67
+                        if (srcMap.find("__packager_asset") != srcMap.end()) {
68
+                            isPackagerAsset = srcMap.at("__packager_asset").AsBoolean();
69
+                        }
70
+
71
+                        if (isPackagerAsset && uriString.find("assets") == 0) {
72
+                            uriString.replace(0, 6, "ms-appx://");
73
+                        }
74
+
75
+                        webView.Navigate(winrt::Uri(to_hstring(uriString)));
76
+                    }
77
+                    else if (srcMap.find("html") != srcMap.end()) {
78
+                        auto htmlString = srcMap.at("html").AsString();
79
+                        webView.NavigateToString(to_hstring(htmlString));
80
+                    }
81
+                }
82
+                else if (propertyName == "backgroundColor") {
83
+                    auto color = propertyValue.To<winrt::Color>();
84
+                    webView.DefaultBackgroundColor(color.A==0 ? winrt::Colors::Transparent() : color);
85
+                }
86
+            }
87
+        }
88
+    }
89
+
90
+    // IViewManagerWithExportedEventTypeConstants
91
+    ConstantProviderDelegate ReactWebViewManager::ExportedCustomBubblingEventTypeConstants() noexcept {
92
+        return nullptr;
93
+    }
94
+
95
+    ConstantProviderDelegate ReactWebViewManager::ExportedCustomDirectEventTypeConstants() noexcept {
96
+        return [](winrt::IJSValueWriter const& constantWriter) {
97
+            WriteCustomDirectEventTypeConstant(constantWriter, "onLoadingStart");
98
+            WriteCustomDirectEventTypeConstant(constantWriter, "onLoadingFinish");
99
+            WriteCustomDirectEventTypeConstant(constantWriter, "onLoadingError");
100
+            WriteCustomDirectEventTypeConstant(constantWriter, "onMessage");
101
+        };
102
+    }
103
+
104
+    // IViewManagerWithCommands
105
+    IMapView<hstring, int64_t> ReactWebViewManager::Commands() noexcept {
106
+        auto commands = winrt::single_threaded_map<hstring, int64_t>();
107
+        commands.Insert(L"goForward", static_cast<int32_t>(WebViewCommands::GoForward));
108
+        commands.Insert(L"goBack", static_cast<int32_t>(WebViewCommands::GoBack));
109
+        commands.Insert(L"reload", static_cast<int32_t>(WebViewCommands::Reload));
110
+        commands.Insert(L"stopLoading", static_cast<int32_t>(WebViewCommands::StopLoading));
111
+        commands.Insert(L"injectJavaScript", static_cast<int32_t>(WebViewCommands::InjectJavaScript));
112
+        return commands.GetView();
113
+    }
114
+
115
+    void ReactWebViewManager::DispatchCommand(
116
+        FrameworkElement const& view,
117
+        int64_t commandId,
118
+        winrt::IJSValueReader const& commandArgsReader) noexcept {
119
+        if (auto webView = view.try_as<winrt::WebView>()) {
120
+            switch (commandId) {
121
+                case static_cast<int64_t>(WebViewCommands::GoForward) :
122
+                    if (webView.CanGoForward()) {
123
+                        webView.GoForward();
124
+                    }
125
+                    break;
126
+                case static_cast<int64_t>(WebViewCommands::GoBack) :
127
+                    if (webView.CanGoBack()) {
128
+                        webView.GoBack();
129
+                    }
130
+                    break;
131
+                case static_cast<int64_t>(WebViewCommands::Reload) :
132
+                    webView.Refresh();
133
+                    break;
134
+                case static_cast<int64_t>(WebViewCommands::StopLoading) :
135
+                    webView.Stop();
136
+                    break;
137
+                case static_cast<int64_t>(WebViewCommands::InjectJavaScript) :
138
+                    webView.InvokeScriptAsync(L"eval", { commandArgsReader.GetString() });
139
+                    break;
140
+            }
141
+        }
142
+    }
143
+
144
+} // namespace winrt::ReactWebView::implementation

+ 56
- 0
windows/ReactNativeWebView/ReactWebViewManager.h Ver arquivo

@@ -0,0 +1,56 @@
1
+// Copyright (c) Microsoft Corporation. All rights reserved.
2
+// Licensed under the MIT License.
3
+
4
+#pragma once
5
+#include "winrt/Microsoft.ReactNative.h"
6
+#include "NativeModules.h"
7
+#include "ReactWebView.h"
8
+
9
+namespace winrt::ReactNativeWebView::implementation {
10
+    
11
+    enum class WebViewCommands : int32_t { GoForward = 0, GoBack = 1,  Reload = 2, StopLoading = 3, InjectJavaScript = 4 };
12
+
13
+    class ReactWebViewManager : public winrt::implements<
14
+        ReactWebViewManager,
15
+        winrt::Microsoft::ReactNative::IViewManager,
16
+        winrt::Microsoft::ReactNative::IViewManagerWithReactContext,
17
+        winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties,
18
+        winrt::Microsoft::ReactNative::IViewManagerWithExportedEventTypeConstants,
19
+        winrt::Microsoft::ReactNative::IViewManagerWithCommands> {
20
+    public:
21
+        ReactWebViewManager();
22
+        // IViewManager
23
+        winrt::hstring Name() noexcept;
24
+        winrt::Windows::UI::Xaml::FrameworkElement CreateView() noexcept;
25
+
26
+        // IViewManagerWithReactContext
27
+        winrt::Microsoft::ReactNative::IReactContext ReactContext() noexcept;
28
+        void ReactContext(winrt::Microsoft::ReactNative::IReactContext reactContext) noexcept;
29
+
30
+        // IViewManagerWithNativeProperties
31
+        winrt::Windows::Foundation::Collections::
32
+            IMapView<winrt::hstring, winrt::Microsoft::ReactNative::ViewManagerPropertyType>
33
+            NativeProps() noexcept;
34
+
35
+        void UpdateProperties(
36
+            winrt::Windows::UI::Xaml::FrameworkElement const& view,
37
+            winrt::Microsoft::ReactNative::IJSValueReader const& propertyMapReader) noexcept;
38
+
39
+        // IViewManagerWithExportedEventTypeConstants
40
+        winrt::Microsoft::ReactNative::ConstantProviderDelegate ExportedCustomBubblingEventTypeConstants() noexcept;
41
+        winrt::Microsoft::ReactNative::ConstantProviderDelegate ExportedCustomDirectEventTypeConstants() noexcept;
42
+
43
+        // IViewManagerWithCommands
44
+        winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, int64_t> Commands() noexcept;
45
+
46
+        void DispatchCommand(
47
+            winrt::Windows::UI::Xaml::FrameworkElement const& view,
48
+            int64_t commandId,
49
+            winrt::Microsoft::ReactNative::IJSValueReader const& commandArgsReader) noexcept;
50
+
51
+    private:
52
+        winrt::ReactNativeWebView::ReactWebView m_reactWebView{ nullptr };
53
+        winrt::Microsoft::ReactNative::IReactContext m_reactContext{ nullptr };
54
+
55
+    };
56
+} // namespace winrt::ReactWebView::implementation

+ 4
- 0
windows/ReactNativeWebView/packages.config Ver arquivo

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

+ 1
- 0
windows/ReactNativeWebView/pch.cpp Ver arquivo

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

+ 13
- 0
windows/ReactNativeWebView/pch.h Ver arquivo

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

+ 10587
- 10059
yarn.lock
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo