@exodus/react-native-webview 11.26.1-exodus.9 → 13.16.0-exodus.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +36 -63
  2. package/android/build.gradle +83 -110
  3. package/android/gradle.properties +3 -4
  4. package/android/src/main/AndroidManifest.xml +12 -0
  5. package/android/src/main/AndroidManifestNew.xml +26 -0
  6. package/android/src/main/java/com/reactnativecommunity/webview/RNCBasicAuthCredential.java +11 -0
  7. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java +407 -0
  8. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebView.java +468 -0
  9. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewClient.java +330 -0
  10. package/android/src/main/java/com/reactnativecommunity/webview/{WebViewConfig.java → RNCWebViewConfig.java} +3 -4
  11. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewFileProvider.java +1 -1
  12. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManagerImpl.kt +746 -0
  13. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewMessagingModule.kt +9 -0
  14. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModuleImpl.java +554 -0
  15. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewPackage.java +57 -12
  16. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewWrapper.kt +39 -0
  17. package/android/src/main/java/com/reactnativecommunity/webview/events/SubResourceErrorEvent.kt +25 -0
  18. package/android/src/main/java/com/reactnativecommunity/webview/events/TopCustomMenuSelectionEvent.kt +24 -0
  19. package/android/src/main/java/com/reactnativecommunity/webview/events/TopHttpErrorEvent.kt +25 -0
  20. package/android/src/main/java/com/reactnativecommunity/webview/events/TopNewWindowEvent.kt +25 -0
  21. package/android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt +25 -0
  22. package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewManager.java +570 -0
  23. package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewModule.java +57 -0
  24. package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewManager.java +341 -0
  25. package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewModule.java +59 -0
  26. package/apple/RCTConvert+WKDataDetectorTypes.h +11 -0
  27. package/apple/RCTConvert+WKDataDetectorTypes.m +27 -0
  28. package/apple/RNCWebView.h +26 -100
  29. package/apple/RNCWebView.mm +555 -0
  30. package/apple/RNCWebViewDecisionManager.h +20 -0
  31. package/apple/RNCWebViewDecisionManager.m +47 -0
  32. package/apple/RNCWebViewImpl.h +164 -0
  33. package/apple/{RNCWebView.m → RNCWebViewImpl.m} +802 -225
  34. package/apple/RNCWebViewManager.h +4 -8
  35. package/apple/RNCWebViewManager.mm +221 -0
  36. package/apple/RNCWebViewModule.h +23 -0
  37. package/apple/RNCWebViewModule.mm +34 -0
  38. package/index.d.ts +2 -3
  39. package/lib/NativeRNCWebViewModule.d.ts +8 -0
  40. package/lib/NativeRNCWebViewModule.js +1 -0
  41. package/lib/RNCWebViewNativeComponent.d.ts +245 -0
  42. package/lib/RNCWebViewNativeComponent.js +1 -0
  43. package/lib/WebView.android.d.ts +0 -1
  44. package/lib/WebView.android.js +1 -135
  45. package/lib/WebView.d.ts +2 -3
  46. package/lib/WebView.ios.d.ts +0 -1
  47. package/lib/WebView.ios.js +1 -114
  48. package/lib/WebView.js +1 -11
  49. package/lib/WebView.macos.d.ts +6 -0
  50. package/lib/WebView.macos.js +1 -0
  51. package/lib/WebView.styles.d.ts +37 -11
  52. package/lib/WebView.styles.js +1 -33
  53. package/lib/WebView.windows.d.ts +17 -0
  54. package/lib/WebView.windows.js +1 -0
  55. package/lib/WebViewNativeComponent.macos.d.ts +3 -0
  56. package/lib/WebViewNativeComponent.macos.js +1 -0
  57. package/lib/WebViewNativeComponent.windows.d.ts +3 -0
  58. package/lib/WebViewNativeComponent.windows.js +1 -0
  59. package/lib/WebViewShared.d.ts +30 -9
  60. package/lib/WebViewShared.js +1 -174
  61. package/lib/WebViewTypes.d.ts +514 -98
  62. package/lib/WebViewTypes.js +1 -6
  63. package/lib/index.d.ts +0 -1
  64. package/lib/index.js +1 -3
  65. package/lib/validation.d.ts +3 -0
  66. package/lib/validation.js +1 -0
  67. package/package.json +57 -33
  68. package/react-native-webview.podspec +32 -5
  69. package/react-native.config.js +22 -18
  70. package/src/NativeRNCWebViewModule.ts +13 -0
  71. package/src/RNCWebViewNativeComponent.ts +348 -0
  72. package/src/WebView.android.tsx +345 -0
  73. package/src/WebView.ios.tsx +341 -0
  74. package/src/WebView.macos.tsx +252 -0
  75. package/src/WebView.styles.ts +41 -0
  76. package/src/WebView.tsx +25 -0
  77. package/src/WebView.windows.tsx +217 -0
  78. package/src/WebViewNativeComponent.macos.ts +7 -0
  79. package/src/WebViewNativeComponent.windows.ts +8 -0
  80. package/src/WebViewShared.tsx +476 -0
  81. package/src/WebViewTypes.ts +1402 -0
  82. package/src/__tests__/WebViewShared-test.js +323 -0
  83. package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +8 -0
  84. package/src/__tests__/validation-test.js +38 -0
  85. package/src/index.ts +4 -0
  86. package/src/validation.ts +20 -0
  87. package/android/.editorconfig +0 -6
  88. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java +0 -1408
  89. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java +0 -506
  90. package/apple/RNCWebViewManager.m +0 -278
  91. package/lib/WebViewNativeComponent.android.d.ts +0 -4
  92. package/lib/WebViewNativeComponent.android.js +0 -3
  93. package/lib/WebViewNativeComponent.ios.d.ts +0 -4
  94. package/lib/WebViewNativeComponent.ios.js +0 -3
package/README.md CHANGED
@@ -1,109 +1,82 @@
1
- # React Native WebView - a Modern, Cross-Platform WebView for React Native
1
+ # React Native WebView
2
2
 
3
- [![star this repo](http://githubbadges.com/star.svg?user=react-native-webview&repo=react-native-webview&style=flat)](https://github.com/react-native-webview/react-native-webview)
3
+ ![star this repo](https://img.shields.io/github/stars/react-native-webview/react-native-webview?style=flat-square)
4
4
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
5
- [![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors)
6
- [![Known Vulnerabilities](https://snyk.io/test/github/react-native-webview/react-native-webview/badge.svg?style=flat-square)](https://snyk.io/test/github/react-native-webview/react-native-webview)
7
5
  [![NPM Version](https://img.shields.io/npm/v/react-native-webview.svg?style=flat-square)](https://www.npmjs.com/package/react-native-webview)
8
- [![Lean Core Extracted](https://img.shields.io/badge/Lean%20Core-Extracted-brightgreen.svg?style=flat-square)][lean-core-issue]
6
+ ![Npm Downloads](https://img.shields.io/npm/dm/react-native-webview.svg)
9
7
 
10
- **React Native WebView** is a modern, well-supported, and cross-platform WebView for React Native. It is intended to be a replacement for the built-in WebView (which will be [removed from core](https://github.com/react-native-community/discussions-and-proposals/pull/3)).
8
+ **React Native WebView** is a community-maintained WebView component for React Native. It is intended to be a replacement for the built-in WebView (which was [removed from core](https://github.com/react-native-community/discussions-and-proposals/pull/3)).
11
9
 
12
- ## Core Maintainers - Sponsoring companies
10
+ ### Maintainers
13
11
 
14
- _This project is maintained for free by these people using both their free time and their company work time._
12
+ **Many thanks to these companies** for providing us with time to work on open source.
13
+ Please note that maintainers spend a lot of free time working on this too so feel free to sponsor them, **it really makes a difference.**
15
14
 
16
- - [Thibault Malbranche](https://github.com/Titozzz) ([Twitter @titozzz](https://twitter.com/titozzz)) from [Brigad](https://www.brigad.co/en-gb/about-us)
17
- - [Jamon Holmgren](https://github.com/jamonholmgren) ([Twitter @jamonholmgren](https://twitter.com/jamonholmgren)) from [Infinite Red](https://infinite.red/react-native)
18
- - [Alexander Sklar](https://github.com/asklar) ([Twitter @alexsklar](https://twitter.com/alexsklar)) from [React Native Windows @ Microsoft](https://microsoft.github.io/react-native-windows/)
19
- - [Chiara Mooney](https://github.com/chiaramooney) from [React Native Windows @ Microsoft](https://microsoft.github.io/react-native-windows/)
15
+ - [Thibault Malbranche](https://github.com/Titozzz) ([Twitter @titozzz](https://twitter.com/titozzz)) from [Brigad](https://www.brigad.co/en-gb/about-us)
16
+ [*Sponsor me* ❤️ !](https://github.com/sponsors/Titozzz)
20
17
 
21
- ## Platforms Supported
22
18
 
23
- - [x] iOS
24
- - [x] Android
25
- - [x] macOS
26
- - [x] Windows
27
- - [x] Expo (Android, iOS)
19
+ Windows and macOS are managed by Microsoft, notably:
20
+ - [Alexander Sklar](https://github.com/asklar) ([Twitter @alexsklar](https://twitter.com/alexsklar)) from [React Native for Windows](https://microsoft.github.io/react-native-windows/)
21
+ - [Chiara Mooney](https://github.com/chiaramooney) from [React Native for Windows @ Microsoft](https://microsoft.github.io/react-native-windows/)
28
22
 
29
- ## Getting Started
23
+ Shout-out to [Jamon Holmgren](https://github.com/jamonholmgren) from [Infinite Red](https://infinite.red) for helping a lot with the repo when he had more available time.
30
24
 
31
- Read our [Getting Started Guide](docs/Getting-Started.md). If any step seems unclear, please create a detailed issue.
25
+ ### Disclaimer
32
26
 
33
- ## Versioning
27
+ Maintaining WebView is very complex because it is often used for many different use cases (rendering SVGs, PDFs, login flows, and much more). We also support many platforms and both architectures of react-native.
34
28
 
35
- This project follows [semantic versioning](https://semver.org/). We do not hesitate to release breaking changes but they will be in a major version.
29
+ Since WebView was extracted from the React Native core, nearly 500 pull requests have been merged.
30
+ Considering that we have limited time, issues will mostly serve as a discussion place for the community, while **we will prioritize reviewing and merging pull requests.**
31
+
32
+ ### Platform compatibility
36
33
 
37
- **Breaking History:**
34
+ This project is compatible with **iOS**, **Android**, **Windows** and **macOS**.
35
+ This project supports both **the old** (paper) **and the new architecture** (fabric).
36
+ This project is compatible with [expo](https://docs.expo.dev/versions/latest/sdk/webview/).
38
37
 
39
- Current Version: ![version](https://img.shields.io/npm/v/react-native-webview.svg)
38
+ ### Getting Started
40
39
 
41
- - [11.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v11.0.0) - Android setSupportMultipleWindows.
42
- - [10.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v10.0.0) - Android Gradle plugin is only required when opening the project stand-alone
43
- - [9.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v9.0.0) - props updates to injectedJavaScript are no longer immutable.
44
- - [8.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v8.0.0) - onNavigationStateChange now triggers with hash url changes
45
- - [7.0.1](https://github.com/react-native-webview/react-native-webview/releases/tag/v7.0.1) - Removed UIWebView
46
- - [6.0.**2**](https://github.com/react-native-webview/react-native-webview/releases/tag/v6.0.2) - Update to AndroidX. Make sure to enable it in your project's `android/gradle.properties`. See [Getting Started Guide](docs/Getting-Started.md).
47
- - [5.0.**1**](https://github.com/react-native-webview/react-native-webview/releases/tag/v5.0.0) - Refactored the old postMessage implementation for communication from webview to native.
48
- - [4.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v4.0.0) - Added cache (enabled by default).
49
- - [3.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v3.0.0) - WKWebview: Add shared process pool so cookies and localStorage are shared across webviews in iOS (enabled by default).
50
- - [2.0.0](https://github.com/react-native-webview/react-native-webview/releases/tag/v2.0.0) - First release this is a replica of the core webview component
40
+ Read our [Getting Started Guide](docs/Getting-Started.md). If any step seems unclear, please create a pull request.
51
41
 
52
- **Upcoming:**
42
+ ### Versioning
53
43
 
54
- - this.webView.postMessage() removal (never documented and less flexible than injectJavascript) -> [how to migrate](https://github.com/react-native-webview/react-native-webview/issues/809)
55
- - Kotlin rewrite
56
- - Maybe Swift rewrite
44
+ This project follows [semantic versioning](https://semver.org/). We do not hesitate to release breaking changes but they will be in a major version.
57
45
 
58
- ## Usage
46
+ ### Usage
59
47
 
60
48
  Import the `WebView` component from `react-native-webview` and use it like so:
61
49
 
62
- ```jsx
50
+ ```tsx
63
51
  import React, { Component } from 'react';
64
52
  import { StyleSheet, Text, View } from 'react-native';
65
53
  import { WebView } from 'react-native-webview';
66
54
 
67
55
  // ...
68
- class MyWebComponent extends Component {
69
- render() {
70
- return <WebView source={{ uri: 'https://reactnative.dev/' }} />;
71
- }
56
+ const MyWebComponent = () => {
57
+ return <WebView source={{ uri: 'https://reactnative.dev/' }} style={{ flex: 1 }} />;
72
58
  }
73
59
  ```
74
60
 
75
61
  For more, read the [API Reference](./docs/Reference.md) and [Guide](./docs/Guide.md). If you're interested in contributing, check out the [Contributing Guide](./docs/Contributing.md).
76
62
 
77
- ## Common issues
63
+ ### Common issues
78
64
 
79
65
  - If you're getting `Invariant Violation: Native component for "RNCWebView does not exist"` it likely means you forgot to run `react-native link` or there was some error with the linking process
80
66
  - If you encounter a build error during the task `:app:mergeDexRelease`, you need to enable multidex support in `android/app/build.gradle` as discussed in [this issue](https://github.com/react-native-webview/react-native-webview/issues/1344#issuecomment-650544648)
81
67
 
82
- ## Contributing
83
-
84
- See [Contributing.md](https://github.com/react-native-webview/react-native-webview/blob/master/docs/Contributing.md)
85
-
86
- ## Contributors
68
+ #### Contributing
87
69
 
88
- Thanks goes to these wonderful people ([emoji key](https://github.com/all-contributors/all-contributors#emoji-key-)):
70
+ Contributions are welcome, see [Contributing.md](https://github.com/react-native-webview/react-native-webview/blob/master/docs/Contributing.md)
89
71
 
90
- <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
91
- <!-- prettier-ignore -->
92
- <table><tr><td align="center"><a href="https://twitter.com/titozzz"><img src="https://avatars1.githubusercontent.com/u/6181446?v=4" width="100px;" alt="Thibault Malbranche"/><br /><sub><b>Thibault Malbranche</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=titozzz" title="Code">💻</a> <a href="#ideas-titozzz" title="Ideas, Planning, & Feedback">🤔</a> <a href="#review-titozzz" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/react-native-community/react-native-webview/commits?author=titozzz" title="Documentation">📖</a> <a href="#maintenance-titozzz" title="Maintenance">🚧</a> <a href="https://github.com/react-native-community/react-native-webview/commits?author=titozzz" title="Tests">⚠️</a> <a href="#infra-titozzz" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#question-titozzz" title="Answering Questions">💬</a></td><td align="center"><a href="https://jamonholmgren.com"><img src="https://avatars3.githubusercontent.com/u/1479215?v=4" width="100px;" alt="Jamon Holmgren"/><br /><sub><b>Jamon Holmgren</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=jamonholmgren" title="Code">💻</a> <a href="#ideas-jamonholmgren" title="Ideas, Planning, & Feedback">🤔</a> <a href="#review-jamonholmgren" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/react-native-community/react-native-webview/commits?author=jamonholmgren" title="Documentation">📖</a> <a href="#maintenance-jamonholmgren" title="Maintenance">🚧</a> <a href="https://github.com/react-native-community/react-native-webview/commits?author=jamonholmgren" title="Tests">⚠️</a> <a href="#example-jamonholmgren" title="Examples">💡</a> <a href="#question-jamonholmgren" title="Answering Questions">💬</a></td><td align="center"><a href="https://github.com/andreipfeiffer"><img src="https://avatars1.githubusercontent.com/u/2570562?v=4" width="100px;" alt="Andrei Pfeiffer"/><br /><sub><b>Andrei Pfeiffer</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=andreipfeiffer" title="Code">💻</a> <a href="#review-andreipfeiffer" title="Reviewed Pull Requests">👀</a> <a href="#ideas-andreipfeiffer" title="Ideas, Planning, & Feedback">🤔</a></td><td align="center"><a href="https://twitter.com/mikediarmid"><img src="https://avatars0.githubusercontent.com/u/5347038?v=4" width="100px;" alt="Michael Diarmid"/><br /><sub><b>Michael Diarmid</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=Salakar" title="Code">💻</a> <a href="#review-Salakar" title="Reviewed Pull Requests">👀</a> <a href="#ideas-Salakar" title="Ideas, Planning, & Feedback">🤔</a> <a href="#tool-Salakar" title="Tools">🔧</a></td><td align="center"><a href="http://smathson.github.io"><img src="https://avatars3.githubusercontent.com/u/932981?v=4" width="100px;" alt="Scott Mathson"/><br /><sub><b>Scott Mathson</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=smathson" title="Code">💻</a> <a href="https://github.com/react-native-community/react-native-webview/commits?author=smathson" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/YangXiaomei"><img src="https://avatars0.githubusercontent.com/u/8221990?v=4" width="100px;" alt="Margaret"/><br /><sub><b>Margaret</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=YangXiaomei" title="Code">💻</a> <a href="https://github.com/react-native-community/react-native-webview/commits?author=YangXiaomei" title="Documentation">📖</a></td><td align="center"><a href="https://stylisted.com"><img src="https://avatars2.githubusercontent.com/u/1173161?v=4" width="100px;" alt="Jordan Sexton"/><br /><sub><b>Jordan Sexton</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=jordansexton" title="Code">💻</a> <a href="https://github.com/react-native-community/react-native-webview/commits?author=jordansexton" title="Documentation">📖</a></td></tr><tr><td align="center"><a href="https://github.com/MalcolmScruggs"><img src="https://avatars1.githubusercontent.com/u/22333355?v=4" width="100px;" alt="Malcolm Scruggs"/><br /><sub><b>Malcolm Scruggs</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=MalcolmScruggs" title="Code">💻</a> <a href="#tool-MalcolmScruggs" title="Tools">🔧</a> <a href="https://github.com/react-native-community/react-native-webview/commits?author=MalcolmScruggs" title="Tests">⚠️</a></td><td align="center"><a href="https://github.com/Momazo7u7"><img src="https://avatars0.githubusercontent.com/u/42069617?v=4" width="100px;" alt="Momazo7u7"/><br /><sub><b>Momazo7u7</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=Momazo7u7" title="Documentation">📖</a></td><td align="center"><a href="https://marco-nett.de"><img src="https://avatars1.githubusercontent.com/u/3315507?v=4" width="100px;" alt="Marco"/><br /><sub><b>Marco</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=marconett" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/jeluard"><img src="https://avatars1.githubusercontent.com/u/359723?v=4" width="100px;" alt="Julien Eluard"/><br /><sub><b>Julien Eluard</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=jeluard" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/CubeSugar"><img src="https://avatars3.githubusercontent.com/u/3667305?v=4" width="100px;" alt="Jian Wei"/><br /><sub><b>Jian Wei</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=CubeSugar" title="Code">💻</a> <a href="https://github.com/react-native-community/react-native-webview/commits?author=CubeSugar" title="Documentation">📖</a></td><td align="center"><a href="https://www.linkedin.com/in/svbutko/"><img src="https://avatars2.githubusercontent.com/u/14828004?v=4" width="100px;" alt="Sergei Butko"/><br /><sub><b>Sergei Butko</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=svbutko" title="Documentation">📖</a></td><td align="center"><a href="https://github.com/TMomemt"><img src="https://avatars3.githubusercontent.com/u/42024947?v=4" width="100px;" alt="TMomemt"/><br /><sub><b>TMomemt</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=TMomemt" title="Code">💻</a></td></tr><tr><td align="center"><a href="http://www.try.com"><img src="https://avatars0.githubusercontent.com/u/674503?v=4" width="100px;" alt="Eric Lewis"/><br /><sub><b>Eric Lewis</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=ericlewis" title="Code">💻</a> <a href="https://github.com/react-native-community/react-native-webview/commits?author=ericlewis" title="Documentation">📖</a></td><td align="center"><a href="https://bzfx.net"><img src="https://avatars2.githubusercontent.com/u/1542454?v=4" width="100px;" alt="Daniel Vicory"/><br /><sub><b>Daniel Vicory</b></sub></a><br /><a href="https://github.com/react-native-community/react-native-webview/commits?author=dvicory" title="Code">💻</a> <a href="https://github.com/react-native-community/react-native-webview/commits?author=dvicory" title="Documentation">📖</a></td></tr></table>
93
-
94
- <!-- ALL-CONTRIBUTORS-LIST:END -->
95
-
96
- This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
97
-
98
- ## License
72
+ ### License
99
73
 
100
74
  MIT
101
75
 
102
- ## Translations
76
+ ### Translations
103
77
 
104
78
  This readme is available in:
105
79
 
106
80
  - [Brazilian portuguese](docs/README.portuguese.md)
107
81
  - [French](docs/README.french.md)
108
-
109
- [lean-core-issue]: https://github.com/facebook/react-native/issues/23313
82
+ - [Italian](docs/README.italian.md)
@@ -1,137 +1,110 @@
1
- buildscript {
2
- ext.getExtOrDefault = {name ->
3
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeWebView_' + name]
4
- }
1
+ import java.nio.file.Paths
5
2
 
6
- // The Android Gradle plugin is only required when opening the android folder stand-alone.
7
- // This avoids unnecessary downloads and potential conflicts when the library is included as a
8
- // module dependency in an application project.
9
- if (project == rootProject) {
3
+ buildscript {
4
+ ext.safeExtGet = {prop ->
5
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : project.properties['ReactNativeWebView_' + prop]
6
+ }
10
7
  repositories {
11
- mavenCentral()
12
- google()
8
+ google()
9
+ gradlePluginPortal()
13
10
  }
14
-
15
11
  dependencies {
16
- classpath("com.android.tools.build:gradle:3.6.0")
17
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
18
- }
19
- } else {
20
- repositories {
21
- mavenCentral()
12
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion')}")
13
+ classpath("com.android.tools.build:gradle:7.0.4")
22
14
  }
15
+ }
23
16
 
24
- dependencies {
25
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
17
+ def getExtOrIntegerDefault(prop) {
18
+ return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : (project.properties['ReactNativeWebView_' + prop]).toInteger()
19
+ }
20
+
21
+ static def findNodeModulePath(baseDir, packageName) {
22
+ def basePath = baseDir.toPath().normalize()
23
+ // Node's module resolution algorithm searches up to the root directory,
24
+ // after which the base path will be null
25
+ while (basePath) {
26
+ def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName)
27
+ if (candidatePath.toFile().exists()) {
28
+ return candidatePath.toString()
29
+ }
30
+ basePath = basePath.getParent()
26
31
  }
27
- }
32
+ return null
28
33
  }
29
34
 
30
- def getExtOrIntegerDefault(name) {
31
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ReactNativeWebView_' + name]).toInteger()
35
+ def isNewArchitectureEnabled() {
36
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
37
+ }
38
+
39
+ def supportsNamespace() {
40
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
41
+ def major = parsed[0].toInteger()
42
+ def minor = parsed[1].toInteger()
43
+
44
+ // Namespace support was added in 7.3.0
45
+ if (major == 7 && minor >= 3) {
46
+ return true
47
+ }
48
+
49
+ return major >= 8
32
50
  }
33
51
 
34
52
  apply plugin: 'com.android.library'
53
+ if (isNewArchitectureEnabled()) {
54
+ apply plugin: 'com.facebook.react'
55
+ }
35
56
  apply plugin: 'kotlin-android'
36
57
 
37
58
  android {
38
- compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
39
- defaultConfig {
40
- minSdkVersion getExtOrIntegerDefault('minSdkVersion')
41
- targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
42
- versionCode 1
43
- versionName "1.0"
44
- }
45
- buildTypes {
46
- release {
47
- minifyEnabled false
59
+ if (supportsNamespace()) {
60
+ namespace "com.reactnativecommunity.webview"
61
+ buildFeatures {
62
+ buildConfig true
63
+ }
64
+
65
+ sourceSets {
66
+ main {
67
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
68
+ }
69
+ }
48
70
  }
49
- }
50
- lintOptions {
51
- disable 'GradleCompatible'
52
- }
53
- compileOptions {
54
- sourceCompatibility JavaVersion.VERSION_1_8
55
- targetCompatibility JavaVersion.VERSION_1_8
56
- }
57
- }
58
71
 
59
- repositories {
60
- mavenCentral()
61
- google()
62
-
63
- def found = false
64
- def defaultDir = null
65
- def androidSourcesName = 'React Native sources'
66
-
67
- if (rootProject.ext.has('reactNativeAndroidRoot')) {
68
- defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
69
- } else {
70
- defaultDir = new File(
71
- projectDir,
72
- '/../../../node_modules/react-native/android'
73
- )
74
- }
72
+ compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
75
73
 
76
- if (defaultDir.exists()) {
77
- maven {
78
- url defaultDir.toString()
79
- name androidSourcesName
74
+ defaultConfig {
75
+ minSdkVersion getExtOrIntegerDefault('minSdkVersion')
76
+ targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
77
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
80
78
  }
81
79
 
82
- logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
83
- found = true
84
- } else {
85
- def parentDir = rootProject.projectDir
86
-
87
- 1.upto(5, {
88
- if (found) return true
89
- parentDir = parentDir.parentFile
90
-
91
- def androidSourcesDir = new File(
92
- parentDir,
93
- 'node_modules/react-native'
94
- )
95
-
96
- def androidPrebuiltBinaryDir = new File(
97
- parentDir,
98
- 'node_modules/react-native/android'
99
- )
100
-
101
- if (androidPrebuiltBinaryDir.exists()) {
102
- maven {
103
- url androidPrebuiltBinaryDir.toString()
104
- name androidSourcesName
105
- }
106
-
107
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
108
- found = true
109
- } else if (androidSourcesDir.exists()) {
110
- maven {
111
- url androidSourcesDir.toString()
112
- name androidSourcesName
80
+ sourceSets {
81
+ main {
82
+ if (isNewArchitectureEnabled()) {
83
+ java.srcDirs += ['src/newarch']
84
+ } else {
85
+ java.srcDirs += ['src/oldarch']
86
+ }
113
87
  }
88
+ }
89
+ }
114
90
 
115
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
116
- found = true
117
- }
118
- })
119
- }
120
-
121
- if (!found) {
122
- throw new GradleException(
123
- "${project.name}: unable to locate React Native android sources. " +
124
- "Ensure you have you installed React Native as a dependency in your project and try again."
125
- )
126
- }
91
+ def reactNativePath = findNodeModulePath(projectDir, "react-native")
92
+ def codegenPath = findNodeModulePath(projectDir, "@react-native/codegen")
93
+ if (codegenPath == null) {
94
+ // Compat for 0.71 and lower (to be removed)
95
+ codegenPath = findNodeModulePath(projectDir, "react-native-codegen")
127
96
  }
128
97
 
129
- def kotlin_version = getExtOrDefault('kotlinVersion')
130
- def webkit_version = getExtOrDefault('webkitVersion')
98
+ repositories {
99
+ maven {
100
+ url "${reactNativePath}/android"
101
+ }
102
+ mavenCentral()
103
+ google()
104
+ }
131
105
 
132
106
  dependencies {
133
- //noinspection GradleDynamicVersion
134
- implementation 'com.facebook.react:react-native:+'
135
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
136
- implementation "androidx.webkit:webkit:$webkit_version"
107
+ implementation 'com.facebook.react:react-native:+'
108
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet('kotlinVersion')}"
109
+ implementation "androidx.webkit:webkit:${safeExtGet('webkitVersion')}"
137
110
  }
@@ -1,6 +1,5 @@
1
1
  ReactNativeWebView_kotlinVersion=1.6.0
2
- ReactNativeWebView_webkitVersion=1.4.0
3
- ReactNativeWebView_compileSdkVersion=29
4
- ReactNativeWebView_buildToolsVersion=29.0.3
5
- ReactNativeWebView_targetSdkVersion=28
2
+ ReactNativeWebView_webkitVersion=1.14.0
3
+ ReactNativeWebView_compileSdkVersion=31
4
+ ReactNativeWebView_targetSdkVersion=31
6
5
  ReactNativeWebView_minSdkVersion=21
@@ -1,6 +1,18 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
2
  package="com.reactnativecommunity.webview">
3
3
 
4
+ <queries>
5
+ <intent>
6
+ <action android:name="org.chromium.intent.action.PAY"/>
7
+ </intent>
8
+ <intent>
9
+ <action android:name="org.chromium.intent.action.IS_READY_TO_PAY"/>
10
+ </intent>
11
+ <intent>
12
+ <action android:name="org.chromium.intent.action.UPDATE_PAYMENT_DETAILS"/>
13
+ </intent>
14
+ </queries>
15
+
4
16
  <application>
5
17
  <provider
6
18
  android:name=".RNCWebViewFileProvider"
@@ -0,0 +1,26 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ <queries>
4
+ <intent>
5
+ <action android:name="org.chromium.intent.action.PAY"/>
6
+ </intent>
7
+ <intent>
8
+ <action android:name="org.chromium.intent.action.IS_READY_TO_PAY"/>
9
+ </intent>
10
+ <intent>
11
+ <action android:name="org.chromium.intent.action.UPDATE_PAYMENT_DETAILS"/>
12
+ </intent>
13
+ </queries>
14
+
15
+ <application>
16
+ <provider
17
+ android:name=".RNCWebViewFileProvider"
18
+ android:authorities="${applicationId}.fileprovider"
19
+ android:exported="false"
20
+ android:grantUriPermissions="true">
21
+ <meta-data
22
+ android:name="android.support.FILE_PROVIDER_PATHS"
23
+ android:resource="@xml/file_provider_paths" />
24
+ </provider>
25
+ </application>
26
+ </manifest>
@@ -0,0 +1,11 @@
1
+ package com.reactnativecommunity.webview;
2
+
3
+ class RNCBasicAuthCredential {
4
+ String username;
5
+ String password;
6
+
7
+ RNCBasicAuthCredential(String username, String password) {
8
+ this.username = username;
9
+ this.password = password;
10
+ }
11
+ }