Skip to content

Commit

Permalink
feat: merge the upstream (#6)
Browse files Browse the repository at this point in the history
* chore(ci): Update React Native to fix Android build (react-native-webview#2734)

See facebook/react-native#35210

* chore(docs): Add information that custom menu items are only available for iOS (react-native-webview#2748)

* feat(ios): Cookie sync improvements (react-native-webview#2535)

* chore(release): 11.24.0 [skip ci]

# [11.24.0](react-native-webview/react-native-webview@v11.23.1...v11.24.0) (2022-11-23)

### Features

* **ios:** Cookie sync improvements ([react-native-webview#2535](react-native-webview#2535)) ([4ac0d74](react-native-webview@4ac0d74))

* feat(Android): Handle RESOURCE_PROTECTED_MEDIA_ID permission (react-native-webview#2732)

* chore(release): 11.25.0 [skip ci]

# [11.25.0](react-native-webview/react-native-webview@v11.24.0...v11.25.0) (2022-11-26)

### Features

* **Android:** Handle RESOURCE_PROTECTED_MEDIA_ID permission ([react-native-webview#2732](react-native-webview#2732)) ([2711f3a](react-native-webview@2711f3a))

* fix(android): Respect "filename*" parameter in the field Content-Disposition when detecting filenames for downloading. (react-native-webview#2767)

* chore(release): 11.25.1 [skip ci]

## [11.25.1](react-native-webview/react-native-webview@v11.25.0...v11.25.1) (2022-12-07)

### Bug Fixes

* **android:** Respect "filename*" parameter in the field Content-Disposition when detecting filenames for downloading. ([react-native-webview#2767](react-native-webview#2767)) ([47c05b0](react-native-webview@47c05b0))

* feat(macos): Support File Input On Macos (react-native-webview#2733)

* chore(release): 11.26.0 [skip ci]

# [11.26.0](react-native-webview/react-native-webview@v11.25.1...v11.26.0) (2022-12-09)

### Features

* **macos:** Support File Input On Macos ([react-native-webview#2733](react-native-webview#2733)) ([9b7ce57](react-native-webview@9b7ce57))

* chore: Update Getting-Started.md (react-native-webview#2791)

* fix(js): messagingEnabled prop (react-native-webview#2666)

This was always being set to "true", even if no onMessage handler was provided

* chore(docs): Add info/warning about injectedJavaScriptBeforeContentLoaded for Android (react-native-webview#2746)

* Add acknowledgement that injectedJavaScriptBeforeContentLoaded is implemented for Android, but warning that it may be unreliable

* Linkify?

* chore: bump react-native-macos to 0.68 (react-native-webview#2828)

* chore(release): 11.26.1 [skip ci]

## [11.26.1](react-native-webview/react-native-webview@v11.26.0...v11.26.1) (2023-01-27)

### Bug Fixes

* **js:** messagingEnabled prop ([react-native-webview#2666](react-native-webview#2666)) ([f74ee7a](react-native-webview@f74ee7a))

* chore(docs): Fix clearCache link in index (react-native-webview#2814)

* chore(docs): README fixes: badge, minor wording tweaks (react-native-webview#2880)

* chore: Update Guide.md (react-native-webview#2906)

* feat: Fabric support (react-native-webview#2686)

Hello everyone, the support for new architecture (fabric) is finally landing 🚀 . I've taken a lot of time but I've had to re-understand the whole codebase, the old arch, the new arch, and I did not want to take too many shortcuts.

This release should be mostly non breaking (except for a few well deserved props removals).
HOWEVER, this is a lot of code over a lot of time. Mistakes can happen, if you feel unsafe stick to v11 for a lil' while.

Finally this will unblock many PR (sorry for the conflicts in advance), so let's get releasing again 🔥 

If you appreciate my work please to [sponsor me](https://github.com/sponsors/Titozzz)

BREAKING CHANGE:

- If you are using custom native implementation are still possible on the old arch but many classes were moved / renamed so they will need some changes

- removed the following props: androidHardwareAccelerationDisabled (deprecated), urlPrefixesForDefaultIntent (unused)

* chore(release): 12.0.0 [skip ci]

# [12.0.0](react-native-webview/react-native-webview@v11.26.1...v12.0.0) (2023-04-01)

### Features

* Fabric support ([react-native-webview#2686](react-native-webview#2686)) ([5558e28](react-native-webview@5558e28))

### BREAKING CHANGES

* - If you are using custom native implementation are still possible on the old arch but many classes were moved / renamed so they will need some changes

- removed the following props: androidHardwareAccelerationDisabled (deprecated), urlPrefixesForDefaultIntent (unused)

* fix(iOS): Foundation Import (react-native-webview#2917)

Fixed a build issue that could be happening on iOS see react-native-webview#2915

* chore(release): 12.0.1 [skip ci]

## [12.0.1](react-native-webview/react-native-webview@v12.0.0...v12.0.1) (2023-04-04)

### Bug Fixes

* **iOS:** Foundation Import ([react-native-webview#2917](react-native-webview#2917)) ([a2eec17](react-native-webview@a2eec17)), closes [react-native-webview#2915](react-native-webview#2915)

* fix(ios): fix userAgent ios type comment (react-native-webview#2888)

* chore(release): 12.0.2 [skip ci]

## [12.0.2](react-native-webview/react-native-webview@v12.0.1...v12.0.2) (2023-04-06)

### Bug Fixes

* **ios:** fix userAgent ios type comment ([react-native-webview#2888](react-native-webview#2888)) ([4d0c0de](react-native-webview@4d0c0de))

* fix(Android): Don't crash while downloading file with % in filename (react-native-webview#2861)

* chore(release): 12.0.3 [skip ci]

## [12.0.3](react-native-webview/react-native-webview@v12.0.2...v12.0.3) (2023-05-22)

### Bug Fixes

* **Android:** Don't crash while downloading file with % in filename ([react-native-webview#2861](react-native-webview#2861)) ([81e3aa4](react-native-webview@81e3aa4))

* bump min version (react-native-webview#2955)

* chore: fix typo (react-native-webview#2868)

* feat: make pushState changes trackable on android (react-native-webview#2929)

Authored-by: Peter Lazar <peter.lazar@limehome.de>

* chore(release): 12.1.0 [skip ci]

# [12.1.0](react-native-webview/react-native-webview@v12.0.3...v12.1.0) (2023-05-23)

### Features

* make pushState changes trackable on android ([react-native-webview#2929](react-native-webview#2929)) ([39ce007](react-native-webview@39ce007))

* Missing android.support.FILE_PROVIDER_PATHS meta-data on some OEMs (react-native-webview#2952)

We (Microsoft Office apps) are seeing the following crashes in certain OEMs (biased toward Samsung)
Exception java.lang.RuntimeException: Unable to get provider com.reactnativecommunity.webview.RNCWebViewFileProvider: java.lang.IllegalArgumentException: Missing android.support.FILE_PROVIDER_PATHS meta-data
  at android.app.ActivityThread.installProvider (ActivityThread.java:6840)
  at android.app.ActivityThread.installContentProviders (ActivityThread.java:6382)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6286)
  ...
Caused by java.lang.IllegalArgumentException: Missing android.support.FILE_PROVIDER_PATHS meta-data
  at androidx.core.content.FileProvider.d
  at androidx.core.content.FileProvider.h
  at androidx.core.content.FileProvider.e
  at androidx.core.content.FileProvider.attachInfoMAM
  ..

Upon further investigation, we found the hypothesis that some OEMs strip meta-data from the manifest (though we don't have any solid data to confirm).

This discussion is related : https://issuetracker.google.com/issues/237727754?pli=1
And this commit into AOSP : https://android-review.googlesource.com/c/platform/frameworks/support/+/1978527

* feat(windows): Support headers and cookies in source prop (react-native-webview#2897)

* [windows] Support headers and cookies in source prop

* minor fixes

* chore(release): 12.2.0 [skip ci]

# [12.2.0](react-native-webview/react-native-webview@v12.1.0...v12.2.0) (2023-06-01)

### Features

* **windows:** Support headers and cookies in source prop ([react-native-webview#2897](react-native-webview#2897)) ([1851ead](react-native-webview@1851ead))

* fix: Revert "Missing android.support.FILE_PROVIDER_PATHS meta-data on some OEMs (react-native-webview#2952)"

This reverts commit 75e7801.

* chore(release): 12.2.1 [skip ci]

## [12.2.1](react-native-webview/react-native-webview@v12.2.0...v12.2.1) (2023-06-10)

### Bug Fixes

* Revert "Missing android.support.FILE_PROVIDER_PATHS meta-data on some OEMs ([react-native-webview#2952](react-native-webview#2952))" ([e17a79b](react-native-webview@e17a79b))

* feat: custom action menu on android + improved iOS (react-native-webview#2993)

* Update RNCWebView.java

* Update RNCWebView.java

* wip

* wip

* fix build on latest xcode

* add example + fix a few things

* Update RNCWebViewImpl.m

* fix macOS build

* chore(release): 12.3.0 [skip ci]

# [12.3.0](react-native-webview/react-native-webview@v12.2.1...v12.3.0) (2023-06-10)

### Features

* custom action menu on android + improved iOS ([react-native-webview#2993](react-native-webview#2993)) ([f2aef66](react-native-webview@f2aef66))

* feat: debugging enabled prop (react-native-webview#2937)

* feat: add webviewDebuggingEnabled prop & Android implementation

fix: use static RNCWebView.setWebContentsDebuggingEnabled

* feat: add iOS webviewDebuggingEnabled prop

* chore: remove "link generted with jump2header" comments

* chore: add missing props-index links in Reference.md

* feat: add webviewDebuggingEnabled reference docs

* fix: surround inspectable code blocks with compiler preprocessor to include only on appropriate versions


---------

Co-authored-by: Tom Bury <tom.bury@twipemobile.com>

* chore(release): 12.4.0 [skip ci]

# [12.4.0](react-native-webview/react-native-webview@v12.3.0...v12.4.0) (2023-06-10)

### Features

* debugging enabled prop ([react-native-webview#2937](react-native-webview#2937)) ([f9a5277](react-native-webview@f9a5277))

* feat: Allow webview to load in background tab (react-native-webview#2930)

BREAKING CHANGE: This affects an existing loading behavior so we marked it as breaking, just in case

Co-authored-by: Peter Lazar <peter.lazar@limehome.de>
Co-authored-by: Thibault Malbranche <thibault@brigad.co>

* chore(release): 13.0.0 [skip ci]

# [13.0.0](react-native-webview/react-native-webview@v12.4.0...v13.0.0) (2023-06-10)

### Features

* Allow webview to load in background tab ([react-native-webview#2930](react-native-webview#2930)) ([40c9807](react-native-webview@40c9807))

### BREAKING CHANGES

* This affects an existing loading behavior so we marked it as breaking, just in case

Co-authored-by: Peter Lazar <peter.lazar@limehome.de>
Co-authored-by: Thibault Malbranche <thibault@brigad.co>

* feat(iOS): fraudulent website warning setting (previously react-native-webview#2801) (react-native-webview#2994)

* feat: fraudulentWebsiteWarningEnabled
* chore: test new arch on CI

# Conflicts:
#	docs/Reference.md

* fix: missing type

* feat: add ios13 check

* Update src/WebViewTypes.ts

Co-authored-by: Caleb Clarke <TheAlmightyBob@users.noreply.github.com>

* Update docs/Reference.md

Co-authored-by: Caleb Clarke <TheAlmightyBob@users.noreply.github.com>

* implem adaptation

* Update ios-ci.yml

* Update ios-ci.yml

* Update android-ci.yml

* Update ios-ci.yml

* fix android new arch

* Update ios-ci.yml

---------

Co-authored-by: sunnylqm <sunnylqm@gmail.com>
Co-authored-by: Caleb Clarke <TheAlmightyBob@users.noreply.github.com>

* chore(release): 13.1.0 [skip ci]

# [13.1.0](react-native-webview/react-native-webview@v13.0.0...v13.1.0) (2023-06-10)

### Features

* **iOS:** fraudulent website warning setting (previously [react-native-webview#2801](react-native-webview#2801)) ([react-native-webview#2994](react-native-webview#2994)) ([6d185e6](react-native-webview@6d185e6))

* feat(android): Add support for the `capture` attribute (react-native-webview#2954)

Co-authored-by: Thibault Malbranche <thibault@brigad.co>

* chore(release): 13.2.0 [skip ci]

# [13.2.0](react-native-webview/react-native-webview@v13.1.0...v13.2.0) (2023-06-11)

### Features

* **android:** Add support for the `capture` attribute ([react-native-webview#2954](react-native-webview#2954)) ([966221e](react-native-webview@966221e))

* fix: build on 0.72 new arch (react-native-webview#2997)

* chore(release): 13.2.1 [skip ci]

## [13.2.1](react-native-webview/react-native-webview@v13.2.0...v13.2.1) (2023-06-12)

### Bug Fixes

* build on 0.72 new arch ([react-native-webview#2997](react-native-webview#2997)) ([7ceeb2f](react-native-webview@7ceeb2f))

* fix(macOS): address regression due to didMoveToSuperview (react-native-webview#3006)

Co-authored-by: Vahagn Nikoghosyan <vahagnn@meta.com>

* chore(release): 13.2.2 [skip ci]

## [13.2.2](react-native-webview/react-native-webview@v13.2.1...v13.2.2) (2023-06-14)

### Bug Fixes

* **macOS:** address regression due to didMoveToSuperview ([react-native-webview#3006](react-native-webview#3006)) ([41576ca](react-native-webview@41576ca))

* chore(docs): Add Italian translation to the docs 🇮🇹📖 (react-native-webview#3031)

* fix: Revert didMoveToSuperview back to didMoveToWindow (react-native-webview#3041)

Fixes multiple issues with the iOS new architecture (WebViews not rendering, javascript on pages not working, possibly more) and occasional crash with the iOS old architecture.

* chore(release): 13.2.3 [skip ci]

## [13.2.3](react-native-webview/react-native-webview@v13.2.2...v13.2.3) (2023-07-18)

### Bug Fixes

* Revert didMoveToSuperview back to didMoveToWindow ([react-native-webview#3041](react-native-webview#3041)) ([836f717](react-native-webview@836f717))

* chore: Update Guide.md to link a working static server package (react-native-webview#3049)

The static server package does not seem to work in the later version of React Native. Or, there's a way to make it work but not discussed. 
A fork of this [library](https://github.com/birdofpreyru/react-native-static-server) works as expected. 
While it may not have many 'stars' the fact that it works and is also maintained, makes it a more suitable candidate.

* feat: Add `onOpenWindow` event (react-native-webview#2640)

* chore(release): 13.3.0 [skip ci]

# [13.3.0](react-native-webview/react-native-webview@v13.2.3...v13.3.0) (2023-07-24)

### Features

* Add `onOpenWindow` event ([react-native-webview#2640](react-native-webview#2640)) ([933fe19](react-native-webview@933fe19))

* chore(docs): Fix typo in Reference.md (react-native-webview#3071)

* fix(docs): Reference documentation updates for menuItems (react-native-webview#3046)

* chore(release): 13.3.1 [skip ci]

## [13.3.1](react-native-webview/react-native-webview@v13.3.0...v13.3.1) (2023-07-31)

### Bug Fixes

* **docs:** Reference documentation updates for menuItems ([react-native-webview#3046](react-native-webview#3046)) ([fcd6050](react-native-webview@fcd6050))

* chore(docs): Update debugging instructions (react-native-webview#3029)

* chore: bump react-native-macos to 0.71 (react-native-webview#3103)

* chore: bump react-native-macos to 0.71

* keep `add:macos`

* feat(iOS): Suppress menu items (react-native-webview#3082)

* chore(release): 13.4.0 [skip ci]

# [13.4.0](react-native-webview/react-native-webview@v13.3.1...v13.4.0) (2023-08-25)

### Features

* **iOS:** Suppress menu items ([react-native-webview#3082](react-native-webview#3082)) ([5cd324c](react-native-webview@5cd324c))

* feat: Add clearCache method on iOS (react-native-webview#3119)

* Add clearCache method on iOS

* Update ClearData.tsx to remove comments

Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>

* Update ClearData.tsx to remove commented code

Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>

---------

Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>

* chore(release): 13.5.0 [skip ci]

# [13.5.0](react-native-webview/react-native-webview@v13.4.0...v13.5.0) (2023-08-29)

### Features

* Add clearCache method on iOS ([react-native-webview#3119](react-native-webview#3119)) ([0868f91](react-native-webview@0868f91))

* fix(ios): Fixes new ios clearCache method where it wasn't getting attached (react-native-webview#3122 by @jamonholmgren and @robinheinze)

* chore(release): 13.5.1 [skip ci]

## [13.5.1](react-native-webview/react-native-webview@v13.5.0...v13.5.1) (2023-08-29)

### Bug Fixes

* **ios:** Fixes new ios clearCache method where it wasn't getting attached ([react-native-webview#3122](react-native-webview#3122) by [@jamonholmgren](https://github.com/jamonholmgren) and [@robinheinze](https://github.com/robinheinze)) ([f101eaf](react-native-webview@f101eaf))

* feat(android): Android injectJavaScriptObject (react-native-webview#2960)

* chore(release): 13.6.0 [skip ci]

# [13.6.0](react-native-webview/react-native-webview@v13.5.1...v13.6.0) (2023-09-08)

### Features

* **android:** Android injectJavaScriptObject ([react-native-webview#2960](react-native-webview#2960)) ([447f68e](react-native-webview@447f68e))

* chore(docs): Add InjectedJavaScriptObject link in Reference.md (react-native-webview#3139)

* fix: add namespace to build.gradle for gradle 8 compat (required for 0.73) (react-native-webview#3055)

* Update build.gradle

* improve fix

* Update build.gradle

* Update build.gradle

---------

Co-authored-by: Thibault Malbranche <malbranche.thibault@gmail.com>

* chore(release): 13.6.1 [skip ci]

## [13.6.1](react-native-webview/react-native-webview@v13.6.0...v13.6.1) (2023-10-06)

### Bug Fixes

* add namespace to build.gradle for gradle 8 compat (required for 0.73) ([react-native-webview#3055](react-native-webview#3055)) ([c4c8e4c](react-native-webview@c4c8e4c))

* fix(android): Prevent libhwui crash when WebView is in ScrollView (react-native-webview#2874)

* fix(android): Prevent libhwui crash when WebView is in ScrollView

* fix incorrect reactTag for event passing

* fix regression from Background example test case

* fix getParent NPE

* Apply suggestions from code review

* Fix rebase conflict

* chore(release): 13.6.2 [skip ci]

## [13.6.2](react-native-webview/react-native-webview@v13.6.1...v13.6.2) (2023-10-06)

### Bug Fixes

* **android:** Prevent libhwui crash when WebView is in ScrollView ([react-native-webview#2874](react-native-webview#2874)) ([886664d](react-native-webview@886664d))

* fix: Adds field `"react-native"` to `package.json` (react-native-webview#3209)

* chore(release): 13.6.3 [skip ci]

## [13.6.3](react-native-webview/react-native-webview@v13.6.2...v13.6.3) (2023-11-22)

### Bug Fixes

* Adds field `"react-native"` to `package.json` ([react-native-webview#3209](react-native-webview#3209)) ([ecc1100](react-native-webview@ecc1100))

* fix(iOS): update podspec to use install_modules_dependencies (react-native-webview#3231)

* update podspec to be compatible with RN 0.72

* improved fallback

* chore(readme): fix typos (react-native-webview#3270)

Fixed grammar issues

* fix(android): add buildFeatures.buildConfig true for AGP8+ compat (react-native-webview#3219)

* chore(release): 13.6.4 [skip ci]

## [13.6.4](react-native-webview/react-native-webview@v13.6.3...v13.6.4) (2024-01-02)

### Bug Fixes

* **android:** add buildFeatures.buildConfig true for AGP8+ compat ([react-native-webview#3219](react-native-webview#3219)) ([f849077](react-native-webview@f849077))
* **iOS:** update podspec to use install_modules_dependencies ([react-native-webview#3231](react-native-webview#3231)) ([b4f047a](react-native-webview@b4f047a))

* chore(docs): update cacheEnabled description (react-native-webview#3260)

* chore(android): Update new architecture config (react-native-webview#3047)

* Update podspec

* Remove `react` block from `build.gradle`

---------

Co-authored-by: Thibault Malbranche <thibault@brigad.co>

* feat(Windows): Add support for custom headers, POST requests and `onOpenWindow` to Windows

* Add WindowsWebViewCommands and implement releaseFocus

* Fixes to setup request methos, added helpers class to visual studio project and fixed missing FocusManager namespace

* Add LinkHandlingEnabled property to allow application to handle request by the webview to open new windows

* Refactor cookie handling in ReactWebView2.cpp

* Fix WebView source handling and add new commands

* Add linkHandlingEnabled property to nativeProps

* Add postMessage and loadUrl commands to command list

* Add loadUrl function to WebViewComponent

* Refactor string manipulation functions in ReactWebViewHelpers

* Refactor cookie handling in ReactWebView2.cpp

* Update RNCWebViewUIManagerWindows type in WebViewTypes.ts

* Fix WebView messaging functionality

* Add useWebView2 prop to WebView component

* Update test to include alert support in WebView2

* Create Windows specific example components for testing webview scenarios

* Update documentation

---------

Co-authored-by: Kennedy Mumo <kemumo@microsoft.com>

* chore(release): 13.7.0 [skip ci]

# [13.7.0](react-native-webview/react-native-webview@v13.6.4...v13.7.0) (2024-01-31)

### Features

* **Windows:** Add support for custom headers, POST requests and `onOpenWindow` to Windows ([9e2794e](react-native-webview@9e2794e))

* fix(Windows): Refactor ReactWebView2.cpp to handle optional 'method' parameter (react-native-webview#3319)

Co-authored-by: Kennedy Mumo <kemumo@microsoft.com>

* chore(release): 13.7.1 [skip ci]

## [13.7.1](react-native-webview/react-native-webview@v13.7.0...v13.7.1) (2024-02-06)

### Bug Fixes

* **Windows:** Refactor ReactWebView2.cpp to handle optional 'method' parameter ([react-native-webview#3319](react-native-webview#3319)) ([f0791d8](react-native-webview@f0791d8))

* fix(ios, macos): Suspend media playback when destroying WebView on iOS/macOS (react-native-webview#3234)

* Suspend media playback when destroying WebView on iOS/macOS

* Fixes crash on iOS <15.0 and macOS <12.0 when pausing playback on dismount

---------

Co-authored-by: Thibault Malbranche <thibault@brigad.co>

* fix(iOS): Replace UIKit with RCTUIKit on MacOS for RCT_NEW_ARCH_ENABLED (react-native-webview#3296)

* Replace UIKit with RCTUIKit on MacOS for RCT_NEW_ARCH_ENABLED

* Exclude iOS specific destroy handler.

* Fix `Non-constant-expression cannot be narrowed from type 'BOOL' (aka 'signed char') to 'bool' in initializer` when building for Release

* Minor fix (typo)

* chore(release): 13.7.2 [skip ci]

## [13.7.2](react-native-webview/react-native-webview@v13.7.1...v13.7.2) (2024-02-13)

### Bug Fixes

* **iOS:** Replace UIKit with RCTUIKit on MacOS for RCT_NEW_ARCH_ENABLED ([react-native-webview#3296](react-native-webview#3296)) ([cb9fb9c](react-native-webview@cb9fb9c))
* **ios, macos:** Suspend media playback when destroying WebView on iOS/macOS ([react-native-webview#3234](react-native-webview#3234)) ([7af398c](react-native-webview@7af398c))

* feat(ios): ios injectJavaScriptObject (react-native-webview#3157)

* feat(ios): injectedJavaScriptObject props connect

* feat(ios): injectedJavaScriptObject ios component props

* feat(ios): injectedObjectJsonScript addUserScript

* refactor(ios): type position lines

* revert: src/WebViewTypes.ts

* docs: support injectedJavaScriptObject ios

* remove log

* fix(ios): return string single quote

* chore(release): 13.8.0 [skip ci]

# [13.8.0](react-native-webview/react-native-webview@v13.7.2...v13.8.0) (2024-02-13)

### Features

* **ios:** ios injectJavaScriptObject ([react-native-webview#3157](react-native-webview#3157)) ([8013944](react-native-webview@8013944))

* Fix NuGet package reference (react-native-webview#3242)

Co-authored-by: Thibault Malbranche <thibault@brigad.co>

* chore(types): Indentation error (react-native-webview#3292)

* fix(android): Fix WebViewManager can no longer be customized (react-native-webview#3315)

* chore(release): 13.8.1 [skip ci]

## [13.8.1](react-native-webview/react-native-webview@v13.8.0...v13.8.1) (2024-02-13)

### Bug Fixes

* **android:** Fix WebViewManager can no longer be customized ([react-native-webview#3315](react-native-webview#3315)) ([0068588](react-native-webview@0068588))

* Merge remote-tracking branch 'upstream/master'

* fix: replace the RNCWebView to RNCWebViewImpl

---------

Co-authored-by: Caleb Clarke <TheAlmightyBob@users.noreply.github.com>
Co-authored-by: Handschrift <privacy.mtehw@aleeas.com>
Co-authored-by: Matias Korhonen <matias.korhonen@kaikuhealth.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: enzo-macri <99820921+enzo-macri@users.noreply.github.com>
Co-authored-by: Xun Sun <UNIDY2002@outlook.com>
Co-authored-by: Amir Angel <36531255+17Amir17@users.noreply.github.com>
Co-authored-by: Gregory <95241798+Gregory-Coelho@users.noreply.github.com>
Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
Co-authored-by: Richard <9120292+Reisclef@users.noreply.github.com>
Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>
Co-authored-by: Pierre-Alain Bouly <pab50000@gmail.com>
Co-authored-by: Thibault Malbranche <thibault@brigad.co>
Co-authored-by: Piotr Kochanowski <63232710+TheKohan@users.noreply.github.com>
Co-authored-by: Valentina M <valentinam@porch.com>
Co-authored-by: Tatiana Kapos <tatianakapos@microsoft.com>
Co-authored-by: flow <hyperflow@kakao.com>
Co-authored-by: Peter Lazar <peterlazar1993@gmail.com>
Co-authored-by: Anandraj <anandrag@microsoft.com>
Co-authored-by: vahagnni <asvahagnas@gmail.com>
Co-authored-by: Thibault Malbranche <malbranche.thibault@gmail.com>
Co-authored-by: Tom Bury <tom.bury@hotmail.com>
Co-authored-by: Tom Bury <tom.bury@twipemobile.com>
Co-authored-by: Peter Lazar <peter.lazar@limehome.de>
Co-authored-by: sunnylqm <sunnylqm@gmail.com>
Co-authored-by: Rob X <robxyy@gmail.com>
Co-authored-by: Vahagn Nikoghosyan <vahagnn@meta.com>
Co-authored-by: Davide Palazzo <davide@revengecreative.com>
Co-authored-by: Nikhil <6836536+qwertynik@users.noreply.github.com>
Co-authored-by: Yannick Chiron <yannick.chiron@gmail.com>
Co-authored-by: Pavlos Vinieratos <pvinis@gmail.com>
Co-authored-by: Naveen <naveen.naveen@gmail.com>
Co-authored-by: Tuur Dutoit <me@tuurdutoit.be>
Co-authored-by: Arjan Zuidema <flecks@gmail.com>
Co-authored-by: Robin Heinze <robin.m.heinze@gmail.com>
Co-authored-by: Kevin VanGelder <kevin.vangelder1@accesscfa.com>
Co-authored-by: Alex Hernandez <oorangecchicken@gmail.com>
Co-authored-by: Kudo Chien <ckchien@gmail.com>
Co-authored-by: Laurent Gaches <laurent@l18.dev>
Co-authored-by: Mehrdad Moradi <me@mmoradi.ca>
Co-authored-by: Mike Hardy <github@mikehardy.net>
Co-authored-by: Wanderson Alves <wandersonalwes@hotmail.com>
Co-authored-by: Jakub Piasecki <jakubpiasecki67@gmail.com>
Co-authored-by: John Kennedy Mumo <jfkenmumo@hotmail.com>
Co-authored-by: Kennedy Mumo <kemumo@microsoft.com>
Co-authored-by: David Sharp <hello@davidsharp.codes>
Co-authored-by: Ivan Suslov <digitalzuzel@gmail.com>
Co-authored-by: Sungyu Kang <gron1gh1@gmail.com>
Co-authored-by: Vijay Bindraban <2269400+VMBindraban@users.noreply.github.com>
Co-authored-by: Caspian Zhao <caspian.zhao@outlook.com>
Co-authored-by: Ryo Kuramoto <dekachan16@gmail.com>
  • Loading branch information
Show file tree
Hide file tree
Showing 109 changed files with 12,637 additions and 6,790 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defaults: &defaults
working_directory: ~/code
docker:
- image: cimg/node:14.17.6-browsers
- image: cimg/node:18.13.0-browsers

version: 2
jobs:
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,28 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
newArchEnabled: [false, true]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v2.5.1
uses: actions/setup-node@v2
with:
node-version: 16
node-version: 18
cache: 'yarn'
- name: Set up JDK
uses: actions/setup-java@v2.5.0
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Cache /node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Install npm dependencies
run: yarn --frozen-lockfile
shell: bash
- name: Build Android test app
uses: gradle/gradle-build-action@v2.1.3
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
arguments: --no-daemon clean build check test
arguments: -PnewArchEnabled=${{matrix.newArchEnabled}} --no-daemon clean build check test
build-root-directory: example/android
timeout-minutes: 60
17 changes: 8 additions & 9 deletions .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@ on:
pull_request:
jobs:
build:
strategy:
matrix:
extraEnv: [FOO=BAR, RCT_NEW_ARCH_ENABLED=1]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v2.5.1
uses: actions/setup-node@v3
with:
node-version: 16
- name: Cache /node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
node-version: 18
cache: 'yarn'
- name: Install npm dependencies
run: yarn --frozen-lockfile
- name: Install Pods
run: pod install
run: ${{matrix.extraEnv}} pod install
working-directory: example/ios
- name: Build iOS test app
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Install npm dependencies
run: yarn --frozen-lockfile
- name: Install macOS dependencies
if: false # Enable this if react-native-macos falls behind
run: yarn add:macos
- name: Install Pods
run: pod install
working-directory: example/macos
Expand Down
21 changes: 7 additions & 14 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,28 @@ on: [pull_request]
jobs:
run-windows-tests:
name: Build & run tests
runs-on: windows-2019
runs-on: windows-2022

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
name: Checkout Code

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '^14'
cache: 'yarn'

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.2

- name: Check node modules cache
uses: actions/cache@v1
id: yarn-cache
uses: microsoft/setup-msbuild@v1.1.3
with:
path: ./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
vs-version: '[17.0,)'
msbuild-architecture: x64

- name: Install node modules
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --pure-lockfile

- name: yarn build
if: steps.yarn-cache.outputs.cache-hit == 'true'
run: |
yarn build
yarn tsc
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# Xcode
#
.xcode.env
build/
*.pbxuser
!default.pbxuser
Expand Down
99 changes: 36 additions & 63 deletions README.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion __tests__/Alert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ describe('Alert Tests', () => {
const showAlertButton = By2.nativeName('Show alert');
await showAlertButton.click();
await By2.nativeName('Hello! I am an alert box!');
// await By2.nativeName('OK').click(); All alerts will be automatically dismissed as Windows Webview does not have support for Alerts https://github.com/MicrosoftDocs/winrt-api/blob/docs/windows.ui.xaml.controls/webview.md#use-of-alert
const okButton = By2.nativeXpath('//Button[@Name="OK"]');
await okButton.click();
const dismissMessage = By2.nativeName('Alert dismissed!');
expect(dismissMessage).not.toBeNull();
await driver.quit();
Expand Down
193 changes: 83 additions & 110 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,137 +1,110 @@
buildscript {
ext.getExtOrDefault = {name ->
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeWebView_' + name]
}
import java.nio.file.Paths

// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
if (project == rootProject) {
buildscript {
ext.safeExtGet = {prop ->
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : project.properties['ReactNativeWebView_' + prop]
}
repositories {
mavenCentral()
google()
google()
gradlePluginPortal()
}

dependencies {
classpath("com.android.tools.build:gradle:3.6.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
}
} else {
repositories {
mavenCentral()
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion')}")
classpath("com.android.tools.build:gradle:7.0.4")
}
}

dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
def getExtOrIntegerDefault(prop) {
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : (project.properties['ReactNativeWebView_' + prop]).toInteger()
}

static def findNodeModulePath(baseDir, packageName) {
def basePath = baseDir.toPath().normalize()
// Node's module resolution algorithm searches up to the root directory,
// after which the base path will be null
while (basePath) {
def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName)
if (candidatePath.toFile().exists()) {
return candidatePath.toString()
}
basePath = basePath.getParent()
}
}
return null
}

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ReactNativeWebView_' + name]).toInteger()
def isNewArchitectureEnabled() {
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

def supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()

// Namespace support was added in 7.3.0
if (major == 7 && minor >= 3) {
return true
}

return major >= 8
}

apply plugin: 'com.android.library'
if (isNewArchitectureEnabled()) {
apply plugin: 'com.facebook.react'
}
apply plugin: 'kotlin-android'

android {
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
defaultConfig {
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
if (supportsNamespace()) {
namespace "com.reactnativecommunity.webview"
buildFeatures {
buildConfig true
}

sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestNew.xml"
}
}
}
}
lintOptions {
disable 'GradleCompatible'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

repositories {
mavenCentral()
google()

def found = false
def defaultDir = null
def androidSourcesName = 'React Native sources'

if (rootProject.ext.has('reactNativeAndroidRoot')) {
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
} else {
defaultDir = new File(
projectDir,
'/../../../node_modules/react-native/android'
)
}
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')

if (defaultDir.exists()) {
maven {
url defaultDir.toString()
name androidSourcesName
defaultConfig {
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
}

logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
found = true
} else {
def parentDir = rootProject.projectDir

1.upto(5, {
if (found) return true
parentDir = parentDir.parentFile

def androidSourcesDir = new File(
parentDir,
'node_modules/react-native'
)

def androidPrebuiltBinaryDir = new File(
parentDir,
'node_modules/react-native/android'
)

if (androidPrebuiltBinaryDir.exists()) {
maven {
url androidPrebuiltBinaryDir.toString()
name androidSourcesName
}

logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
found = true
} else if (androidSourcesDir.exists()) {
maven {
url androidSourcesDir.toString()
name androidSourcesName
sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += ['src/newarch']
} else {
java.srcDirs += ['src/oldarch']
}
}
}
}

logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
found = true
}
})
}

if (!found) {
throw new GradleException(
"${project.name}: unable to locate React Native android sources. " +
"Ensure you have you installed React Native as a dependency in your project and try again."
)
}
def reactNativePath = findNodeModulePath(projectDir, "react-native")
def codegenPath = findNodeModulePath(projectDir, "@react-native/codegen")
if (codegenPath == null) {
// Compat for 0.71 and lower (to be removed)
codegenPath = findNodeModulePath(projectDir, "react-native-codegen")
}

def kotlin_version = getExtOrDefault('kotlinVersion')
def webkit_version = getExtOrDefault('webkitVersion')
repositories {
maven {
url "${reactNativePath}/android"
}
mavenCentral()
google()
}

dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.webkit:webkit:$webkit_version"
implementation 'com.facebook.react:react-native:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet('kotlinVersion')}"
implementation "androidx.webkit:webkit:${safeExtGet('webkitVersion')}"
}
5 changes: 2 additions & 3 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
ReactNativeWebView_kotlinVersion=1.6.0
ReactNativeWebView_webkitVersion=1.4.0
ReactNativeWebView_compileSdkVersion=29
ReactNativeWebView_buildToolsVersion=29.0.3
ReactNativeWebView_targetSdkVersion=28
ReactNativeWebView_compileSdkVersion=31
ReactNativeWebView_targetSdkVersion=31
ReactNativeWebView_minSdkVersion=21
13 changes: 13 additions & 0 deletions android/src/main/AndroidManifestNew.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<provider
android:name=".RNCWebViewFileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths" />
</provider>
</application>
</manifest>

0 comments on commit 35c21f1

Please sign in to comment.