Commit Graph

29 Commits

Author SHA1 Message Date
Malcolm Scruggs fb78d13120 fix(webviewShared.js): Support all valid URI schemes and add testing (#293)
* Change origin whitelist to allow for all valid URIs

- Now supports +, -, and .
- Prevent whitelist from matching when preceded by unwanted characters
- URI must begin with letter
- URI Scheme syntax: https://tools.ietf.org/html/rfc3986#section-3.1

* Add jest testing framework and run it on CI

* Add tests for WebViewShared's createOnShouldStartLoadWithRequest
2019-02-03 19:45:58 +01:00
Thibault Malbranche d5fc028383 fix(PostMessage): Renamed ReactNativeWebview to ReactNativeWebView
fixes #304
2019-02-01 22:04:11 +01:00
Thibault Malbranche e4b851e01a
Update Reference.md 2019-02-01 19:14:07 +01:00
Thibault Malbranche f3bdab5a22
feat(Android/iOS postMessage): refactoring the old postMessage implementation (#303)
fixes #29
fixes #272
fixes #221
fixes #105
fixes #66

BREAKING CHANGE: Communication from webview to react-native has been completely rewritten. React-native-webview will not use or override window.postMessage anymore. Reasons behind these changes can be found throughout so many issues that it made sense to go that way.

Instead of using window.postMessage(data, *), please now use window.ReactNativeWebView.postMessage(data).

Side note: if you wish to keep compatibility with the old version when you upgrade, you can use the injectedJavascript prop to do that:

const injectedJavascript = `(function() {
  window.postMessage = function(data) {
    window.ReactNativeWebView.postMessage(data);
  };
})()`;

Huge thanks to @jordansexton and @KoenLav!
2019-02-01 18:37:28 +01:00
Thibault Malbranche bf3f790358
chore(readme): Updated linking steps 2019-01-31 16:32:14 +01:00
Michael Diarmid 83ce79ff89 feat(iOS/Android): Add `cacheEnabled` prop (#152)
Added a new cacheEnabled prop to toggle Android & iOS webview caching behavior.

BREAKING CHANGE:  This change makes caching enabled by default when previously there was no caching behavior which may cause unexpected behaviour changes in your existing implementations.
2019-01-30 10:32:46 +01:00
Margaret d3fc5e6cde feat(android props): Add `androidHardwareAccelerationDisabled` prop (#265)
* add test code for disable hardware acceleration

* add interface to disable android hardware acceleration

* Update index.d.ts
2019-01-22 10:21:10 +01:00
Roy Zheng 245120df0c Fix typo in Reference.md (#252) 2019-01-18 02:26:20 +01:00
José Luis Pereira 62f871c186 feat(WKWebview): Add incognito prop to iOS WKWebview
Allows the webview to be opened with an ephemeral data storage.
2019-01-11 14:59:03 +01:00
Scott Mathson 2114a9b327 feat(Android Webview): Add file download support for Android (#203)
Addresses #80.

Caveat: I am not an Android developer. This code comes from a fork of the original RN WebView that we have been using in production for some time, so all credit goes to @Oblongmana: https://github.com/Oblongmana/react-native-webview-file-upload-android.

Setting up a DownloadManager for the WebView is pretty straightforward, as is adding any known cookies to the request. Most of the complication comes from the requirement after SDK 23 to ask the user for the WRITE_EXTERNAL_STORAGE permission. Unfortunately there is no mechanism to suspend the download request until permission is resolved so this code stores off the request and sets up a listener that enqueues the download once permissions are resolved so the user experience is really nice.

I didn't see anything in the way of tests or documentation that needs to be added for this change, so let me know if I missed anything. Thanks!
2019-01-07 15:02:47 +01:00
Chi-AnTai 8427a8db69 chore(docs): Add update style doc (#225)
* add style doc in reference.md

* Update Reference.md
2019-01-07 14:56:48 +01:00
Ryan Linton ec469cf00d fix(WKWebview): Surface evaluateJavaScript errors (#179)
In the current code using `startInLoadingState` and `injectedJavaScript` will result in an infinite loading state if `injectedJavaScript` fails to evaluate for some reason. This adds a red box error explaining there was a failure to evaluate javascript. In my case this was do to the JS string not returning a valid type so I've added a that as a potential solution in the error message and added some documentation to the API Reference with some additional warnings.

To reproduce the existing behavior setup a webview with `startInLoadingState` and `injectedJavaScript` that returns an invalid type (in my case it returned a function). You should see an infinite loading state as `onLoadEnd` is never called.

Try the same with this branch and you'll get a nice red box error suggesting one potential solution to the problem.

![simulator screen shot - iphone 8 plus - 2018-11-28 at 15 09 25](https://user-images.githubusercontent.com/1944151/49193714-fccde100-f334-11e8-89dc-bf220e0adf23.png)
2018-12-14 11:24:52 +01:00
Jermaine Oosterling 731dd03fc6 feat(WKWebView): [ios] Add allowsLinkPreview property to WKWebView (#170)
* [ios] Add ‘allowsLinkPreview’ property to iOS WKWebView.

* Add divider in docs

* Typo: add hyphen -> _allowsLinkPreview
2018-11-25 11:17:28 +01:00
wiscat 4870e1f06a feat(WKWebview): [ios] Add 'pagingEnabled' property to the iOS WKWebview (#165) 2018-11-22 13:58:07 +01:00
Andrei Pfeiffer 752a5b295a feat(Android): Support Android file upload (#60)
Fixes #33 

I could really use some help from an Android developer on this one, because I just "made it work", don't know how to "make it work good".

Some things that should be reviewed:

- [ ] validate Android 5.0 devices (my emulator work, but outputs some weird sounds; a Galaxy 4 I tested on crashes)
- [ ] validate Android 5.1 devices (emulator works, couldn't find a real device)
- [ ] how to handle File Extensions? (https://www.w3schools.com/tags/att_input_accept.asp)

I'm sure that there's more refactoring to be done, so any help and advice would be appreciated.
2018-11-21 11:46:43 +01:00
Jamon Holmgren 692961bfca chore(readme): Added contributing guide and empyrical link (#146)
Added a Contributing.md file and moved contributor notes there. Also added @empyrical. 🎉
2018-11-19 11:32:22 +01:00
Thibault Malbranche fd736cf26b
refactor(Android): New project setup + kotlin events (#121) 2018-11-19 11:25:28 +01:00
Lewis Nelson e83818b08c chore(docs):Add docs for missing props which do something (#132) 2018-11-19 11:18:49 +01:00
Bae Hyeonseung 2ec5fa514e feat(WKWebview): Add 'userAgent' property to the iOS WKWebView. (#112)
* Add 'userAgent' property to the iOS WKWebView

* Update 'userAgent' reference docs.
2018-11-19 11:13:31 +01:00
Jamon Holmgren b284bf959b chore(documentation): Update Debugging.md (#96) 2018-10-30 15:47:05 +01:00
ifsnow 6da6b417ba chore(documentation): Updated the documentation for `injectJavaScript` (#114) 2018-10-30 14:48:10 +01:00
Bae Hyeonseung 7f35344632 feat(WKWebview): [iOS] Add 'allowsBackForwardNavigationGestures' property (#97) 2018-10-21 23:12:59 +02:00
Ryan Linton 72f39885c0 Add debugging guide to docs (#94) 2018-10-17 18:19:56 -07:00
marcelkalveram 34512f3c38 feat(New WebView Prop): [iOS] add hideKeyboardAccessoryView option (#67)
* add hideKeyboardAccessoryView option

* add hideKeyboardAccessoryView prop to reference
2018-10-17 16:59:19 +02:00
Thibault Malbranche 2c0059ff61
feat(New Webview Prop): Added Android overscroll property (#54) 2018-10-17 16:48:19 +02:00
黎明 b5aaf5c800 feat(webview props) onLoadProgresss property (#53)
* Added the onLoadProgress property to the iOS wkwebview and Android webview
2018-10-17 15:08:52 +02:00
Jamon Holmgren 935e9518ee Docs updates 2018-09-19 21:20:56 -07:00
Jamon Holmgren f54a37f9d9 Imported custom iOS and Android webview docs (as-is, with warning) 2018-09-19 19:41:27 -07:00
Jamon Holmgren 0ce93a963a Added first draft of docs folder and documentation 2018-09-19 19:27:09 -07:00