Commit Graph

83 Commits

Author SHA1 Message Date
John Kennedy Mumo d352d147bd
feat(windows): Add POST requests, fixes Windows CI issues, and other QOL (#1926)
* Added POST request support for Windows.

* Cleanup formatting for docs

* Updated test certificate

* Reverted publisher name and fixed password mismatch

* Fixes to Windows tests

* Remove winappdriver install

* Run react-native server in background

* Added url encoded form support

* Added support for custom headers

Co-authored-by: Kennedy Mumo <kemumo@microsoft.com>
2021-04-14 01:40:49 +02:00
Ivari Tölp 7decc5cff1
feat(ios): Add support for `limitsNavigationsToAppBoundDomains` (#1662)
* Add support for iOS-specific prop `limitsNavigationsToAppBoundDomains`

* Add check for `limitsNavigationsToAppBoundDomains` property

Turns out that @available is simply bugged right
now in Xcode and will pretty much always return
`true`. Adding a check for the property actually
existing as well will avoid iOS <14 crashing horribly.

* Improve documentation

Co-authored-by: Thibault Malbranche <thibault.malbranche@epitech.eu>
2021-03-17 00:29:40 +01:00
Erik Rothoff Andersson 9c51a17040
chore(docs): Clarify that navigationType and isTopFrame is iOS only (#1880) 2021-03-15 10:21:35 +01:00
Bhargab f7504ccead
chore(docs): fixed "postMessage" url in Reference.md (#1913) 2021-03-15 10:20:57 +01:00
RecianuCiprian 8d098efce7
feat(iOS & MacOS): allowUniversalAccessFromFileURLs property(#1730)
* Added allowUniversalAccessFromFileURLs property to iOS and macOS
Updated the types to include allowUniversalAccessFromFileURLs and allowFileAccessFromFileURLs for iOS and macOS
Updated the Reference.md to include in the allowUniversalAccessFromFileURLs section iOS and macOS

* Updated platform in the type definition
2021-01-20 19:31:42 +01:00
Bill Xie d46a6d3c69
feat(iOS 13+): automaticallyAdjustsScrollIndicatorInsets prop (#1077)
* fix:iOS13  scrollView.automaticallyAdjustsScrollIndicatorInsets default value YES which make the webview vertical indicator position in wrong offset

* added types and doc

Co-authored-by: BillHsieh <xietian@meitunmama.com>
Co-authored-by: xietian <xietian@innotechx.com>
Co-authored-by: Thibault Malbranche <thibault.malbranche@epitech.eu>
Co-authored-by: Thibault Malbranche <malbranche.thibault@gmail.com>
2021-01-20 19:09:27 +01:00
Nizomiddin Toshpulatov 84b7177d21
fix(ts): onScroll event type (#1631)
* Fix onScroll event type

* Update documentation

* Address PR feedback
2020-12-05 20:29:37 +01:00
Lorenzo Sciandra 194c6a2335
feat(android): Introduce setSupportMultipleWindows to mitigate CVE-2020-6506 (#1747 by @mrcoinbase and @kelset -- THANK YOU!)
BREAKING CHANGE:

This release introduces the `setSupportMultipleWindows` prop for Android. This sets the underlying Android WebView setting `setSupportMultipleWindows`. This prop defaults to `true` (previously `false`), and serves to mitigate the security advisory [CVE-2020-6506](https://github.com/react-native-webview/react-native-webview/security/advisories/GHSA-36j3-xxf7-4pqg).

The primary way this new behavior changes existing React Native WebView implementations on Android is that links that open in new tabs/windows (such as `<a target="_blank">`) will now prompt to open in the system browser, rather than re-using the current WebView.

If this behavior is not desirable, you can set this new prop to `false`, but be aware that this exposes your app to the security vulnerability listed above. Make sure you have read and understand the whole advisory and relevant links.

iOS & Windows are unaffected.

```jsx
<WebView
  // ...
  setSupportMultipleWindows={true} // default: true
/>
```

Thanks to @mrcoinbase, @kelset, and @Titozzz for their work on this.
2020-11-24 09:15:19 -08:00
Christopher Pfohl 1bc38da53f
docs: update injectedJavascript ios docs (#1704 bu @Crisfole) 2020-10-21 08:52:28 -07:00
Kesha Antonov 22a60fd23a
feat(iOS): Add prop autoManageStatusBarEnabled (#914)
Co-authored-by: Jamon Holmgren <jamon@infinite.red>
Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>
Co-authored-by: Thibault Malbranche <thibault.malbranche@epitech.eu>
2020-09-15 02:42:09 +02:00
Dominic Lee 40814101be
chore(docs): remove hash url change note (#1622) 2020-09-08 23:55:50 +02:00
oliviacaraiman 9ffca8f9db
feat(android): Add androidLayerType as prop (#1588)
* Add androidLayerType as a prop

* Deprecate "androidHardwareAccelerationDisabled" prop

* Update reference

Co-authored-by: Olivia Caraiman <olcaraim@microsoft.com>
2020-08-24 14:23:38 +02:00
Sergei Butko a02d88f54f
feat(iOS): Add the pull to refresh (#1265)
* Add pull to refresh support for iOS

* Add pull to refresh control removal from WebView

* Add the type and reference description about pull to refresh

* Set bounces to true when enabling pull to refresh, add references

* Add the back to props anchor to pullToRefreshEnabled
2020-08-17 12:07:36 +02:00
Caleb Clarke 6a9116f2d1
feat(events): Add isTopFrame to shouldStartLoadForRequest (#1537)
* Add isTopFrame to shouldStartLoadForRequest on iOS

onLoadingStart is not raised for inner frames, but onShouldStartLoadWithRequest still is. This keeps that behavior but adds isTopFrame to onShouldStartLoadWithRequest so that apps can perform their own filtering if desired.

* Update docs

Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>
2020-08-15 11:21:38 +02:00
Caleb Clarke 8b69452643
feat(ios): Add iOS contentMode property (#1538 by @TheAlmightyBob)
This allows overriding iPadOS 13's desktop-class browsing to load mobile content instead of desktop content.

Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>
2020-08-14 20:16:54 -07:00
cristianoccazinsp 8a8b7ceb98
feat(android): WebView crash handling (#1480)
Co-authored-by: Cristiano Coelho <cristianocca@hotmail.com>
2020-08-06 22:21:01 +02:00
Dragoș Străinu 97aaf89037
docs(reference): add links to top with jump2header (#1528 by @strdr4605)
[skip ci]
2020-07-23 22:21:56 -07:00
Salvatore Randazzo ac4e05e0f2
feat(android): Add support for injectedJavaScriptBeforeContentLoaded on Android (#1099 by @SRandazzo and @ @shirakaba) 2020-06-13 13:54:48 -07:00
Kai Guo e402e739ea
fix(windows): Add postMessage for Windows WebView (#1263 by @kaiguo) 2020-05-29 13:19:11 -07:00
trcoffman 91df544fae
feat(webview): Allow javascript to open windows automatically (#1409 by @trcoffman)
[skip ci]
2020-05-28 09:54:20 -07:00
trcoffman a6010d93e0
feat(iOS): Add onFileDownload callback (#1214)
`onFileDownload` is called with the URL that you can use to download the file.
When RNCWebView detects that the HTTP response should result in a file download,
`onFileDownload` is called. The client can then provide code to download
the file.

RNCWebView determines that a file download should take place if either of the
following is true:
1. The HTTP response contains a `Content-Disposition` header that is of type
  'attachment'
2. The MIME type of the response cannot be rendered by the iOS WebView
2020-04-29 09:09:22 -07:00
RedPandaTronics d4ab332891
feat(iOS): Add Hardware Silence (#1218)
* Fixes Issue #1140

Fixes https://github.com/react-native-community/react-native-webview/issues/1140
Based on a solution found at: https://stackoverflow.com/questions/56460362/how-to-force-wkwebview-to-ignore-hardware-silent-switch-on-ios
I changed the code found in the linked source from Swift to Objective-C, as required by this project. WARNING: I haven't used Swift before and very limited experience with Objective-C.

- For me this seems to work, but it is not the cleanest solution in my opinion.
- It might also be possible to play generated sound (i.e. using oscillator) instead of hardcoding the silent base64 mp3 data.
- Maybe ignoring silence switch should only be done if a parameter is supplied

* fixes import path

* adds documentation for ignoreSilentHardwareSwitch

* adds ignoreSilentHardwareSwitch parameter

* reverting back to old import path

* Update Guide.md

Co-authored-by: Dominik Beste <dominik.beste@gmail.com>
2020-04-13 08:54:47 -07:00
Jamie Birch 9cb2f6e2f3
feat(iOS): WKUserScripts (e.g. injectedJavaScript) can now update upon props change; and can be configured to inject into all frames. (#1119)
BREAKING CHANGE: 
• Props updates to `injectedJavaScript` are no longer immutable.

• `injectedJavaScript` no longer attaches a `jsEvaluationValue` property to the `onLoadingFinish` event. Check out: https://github.com/react-native-community/react-native-webview/pull/1119#issuecomment-574919464 to migrate with the same behavior.
2020-03-17 14:01:20 -07:00
Kai Guo ffee0d4362
feat(Windows): Windows support! (#1220) 2020-03-16 19:30:25 -07:00
Luciano Lima 86c44588f8
chore(docs): Update React Native links to reactnative.dev (#1233) 2020-02-25 22:54:06 -08:00
Tom Underhill 1e572318ec
feat(macOS): macOS Support (#1164) 2020-02-12 15:39:11 -08:00
StasD 88b64981f4 fix(ios): Make allowFileAccessFromFileURLs work in iOS. (#1061) 2019-12-06 11:16:56 +01:00
Salvatore Randazzo 604495e399 feat(iOS): new prop injectedJavaScriptBeforeContentLoaded (#1038)
* Run the injectedJavaScript on DocumentStart for iOS

* Add new prop injectedJavaScriptBeforeContentLoaded
Update types
Update docs

* Self review
2019-12-06 11:15:02 +01:00
Thibault Malbranche ef5c36c88e
chore(docs): Document request focus method 2019-11-13 10:43:25 +01:00
Stanislav Shakirov 4a4f4a2c45 feat(android): add clearHistory, clearCache and clearFormData (#450)
* add clearHistory, clearCache and clearFormData android webview api.

* remove pointless `async`

* add docs for new android webview methods

* Update Reference.md

* update commands types

* add more strict type for RNCWebViewUIManager `Commands` property
2019-11-12 10:09:16 +01:00
Jamon Holmgren 8c9f986df0 chore(docs): Added guide for working with custom headers and cookies (#994)
* Added guide for working with custom headers and cookies

* Remove extraneous files
2019-11-04 17:30:51 +01:00
Borut Balazek 4db3d84dda feat(android): allowFileAccessFromFileURLs prop added (#831)
* add allowFileAccessFromFileURLs propery to do the expected on android

* Added types

* Update WebViewTypes.ts
2019-09-29 15:50:39 +02:00
Andres Castano 5da59251ce feat(android): Expose cacheMode property (#895) 2019-09-29 15:45:20 +02:00
Marco Marinangeli 902d3d1e7f feat(new prop): containerStyle (#912)
* feat(new prop): containerStyle

* chore(docs): Add documentation for `containerStyle`
2019-09-29 15:43:48 +02:00
Tyler Alves fc59cae4bf fix(android): Filter extra onLoadProgress & add url event (#643)
* Filter out extra onLoadProgress calls; add url to onLoadProgress

* remove note about onLoadProgress not having the url property in docs

* Update Reference.md
2019-09-23 10:35:49 +02:00
Samuel Sieg a76811da93 feat(iOS): Add callback for webViewWebContentProcessDidTerminate (#774)
* Add callback for WKWebView's onContentProcessDidTerminate

* Add platform information to docs

* Add new WebViewTerminatedEvent type
2019-09-23 10:20:12 +02:00
Jason Chia-Hsien Ho 552472c414 feat(new prop): onHttpError callback (#885) 2019-09-21 02:43:28 +02:00
George Montana Harkin 36ffbe0700 chore(docs): Update "source" doc, baseUrl comments about CORS (#881)
After needing to see what the origin of a "html" source'd WebView would be, I found the documentation that baseUrl would be utilized for the "origin" header when CORS requests are made.
2019-09-19 11:18:59 +02:00
Thibault Malbranche 8549be5fd0
fix(iOS): UIWebView Removal (#828)
Apple required us to remove this (see #819)

BREAKING CHANGE: UIWebView has been removed
BREAKING CHANGE: useWebkit prop removal
BREAKING CHANGE: scalesPageToFit prop removal on iOS (since it's not compatible with WKWebview)
BREAKING CHANGE: Renamed RNCWKWebView to RNCWebView on iOS
2019-08-30 12:04:32 +02:00
Harry Yu 0424dd0801 feat(iOS): Add prop for allowingReadAccessToURL (#771) 2019-08-29 16:53:09 +02:00
aarondail 493b65de21 feat(iOS): added `contentInsetAdjustmentBehavior` prop
* Adding a `contentInsetAdjustmentBehavior` prop to the WebView for iOS.
This controls the way iOS will automatically adjust the insets when the
webview is behind things like the iPhone X notch.

* Removing the code to explicitly pass contentInsetAdjustmentBehavior to the WebView since it is already passed in otherProps.
2019-08-09 10:55:35 +02:00
Raphael Eidus 9c592d621c feat(android): polyfill applicationNameForUserAgent on Android (#707) 2019-08-02 10:46:03 +02:00
José Luis Pereira 25bc5a55c6 feat(android props): Add incognito to Android (#524) 2019-08-02 09:48:54 +02:00
BettyJJ 1e809932ff chore(types): Update Reference.md (#687)
added doc for the `textZoom` property
2019-07-02 17:38:00 +02:00
Penar Musaraj 71d1fcc675 feat(iOS WKWebView): Add mainDocumentURL to onShouldStartLoadWithRequest(#493)
* Pass mainDocumentURL to onShouldStartLoadWithRequest

* Update reference

* Update typescript types

* Update WebViewTypes.ts
2019-06-13 08:59:52 +02:00
Tijs Teulings a863c6557f chore(docs): Added additional note to `source` parameter (#621)
Added a note about the baseUrl usage since this has been the cause of some filed issues e.g. https://github.com/react-native-community/react-native-webview/issues/526#issuecomment-498067637
2019-06-04 16:46:27 +02:00
Penar Musaraj 4dc4b89e64 feat(iOS WkWebview): Add applicationNameForUserAgent support (#506) 2019-05-21 00:01:22 +02:00
Malcolm Scruggs a0daff92c0 chore(docs): Create example for injectedJavaScript (#571) 2019-05-17 00:24:18 +02:00
Daniel Vicory d72c2ae144 feat(fullscreen videos): Support fullscreen video on Android (#325)
* Extract WebChromeClient from an anonymous class

* Support fullscreen videos on Android

Forces landscape mode while playing.

* Use sticky immersive mode for fullscreen videos

No longer forces landscape mode as that is a problem for portrait videos - allow
the user to rotate as necessary.

Only supports KitKat or greater, and falls back to leaving the status and navigation
bars visible for lower than KitKat. This is the easiest way to prevent issues with
resizing the video during playback.

Also implement a lifecyle event listener which means if a user backgrounds the app
or locks the screen with the video fullscreen, the UI visibility is re-applied.

* Add allowsFullscreenVideo prop to control whether videos can be fullscreen on Android

Luckily, we're able to change the WebChromeClient on demand in response to prop changes
without seeming to do any harm. If you switch to disallow fullscreen, it will attempt
to close the currently fullscreened video (if there is one) so users aren't stuck.

I did notice a bug that if you go from fullscreen allowed, to fullscreen disallowed,
the fullscreen button will remain on the video. Tapping the button will have no effect.
2019-05-17 00:22:08 +02:00
Jamon Holmgren c0332ec607 chore(docs): Adds guide for intercepting hash URL changes (#555) 2019-05-13 09:42:25 +02:00