Commit Graph

67 Commits

Author SHA1 Message Date
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
Ezequiel Aceto 136fbd8491 feat(iOS): Allow custom CA to be used on webview requests (#865)
* Allow custom CA to be used on webview requests

* Add documentation and an example for Custom CA / SSL Pinning
2019-09-21 02:44:53 +02:00
Jason Chia-Hsien Ho 552472c414 feat(new prop): onHttpError callback (#885) 2019-09-21 02:43:28 +02:00
Wilson d25b20ac03 fix(iOS): inconsistent backgroundColor (#868)
* fix inconsistent backgroundColor

* remove redundant setBackgroundColor
2019-09-21 02:39:06 +02:00
hank121314 c366fdf2e7 fix(iOS): use RCTConvert to convert allowingReadAccessToURL. (#845)
* fix(ios):use RCTConvert to convert url instead of using URLWithStringg

* fix(iOS):remove stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding, because it's deprecated in iOS 9
2019-09-05 15:13:33 +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
Arjan Zuidema d87bb58208 fix(iOS): javaScriptEnabled property (#826) 2019-08-30 10:53:48 +02:00
aksmfosef11 a28096bfe7 feat(iOS): add-javaScriptEnabled prop (#592)
* add-javaScriptEnabled-in-IOS

* Update WebViewTypes.ts
2019-08-29 17:09:42 +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
Evgeniy Yurtaev 68f3c08b54 fix(iOS): signature of the swizzled `elementDidFocus` method on iOS 13 2019-08-08 10:32:41 +02:00
Gary Fung 3baebf84db feat(injectedJavaScript): Error replaced by warnings, and callback runs
* Changes error/redbox into warning/yellowbox. So wouldn't crash production releases
* Warning added actual error, useful for debugging bad JS injected into webview
* callback runs, whether there's error or not. As used in my app (https://medium.com/wonderswipe/rethink-mobile-search-10-100x-faster-introducing-wonderswipe-6f2ff0d0e667) which injects JS into sanitized html from the wild, small error in injected JS doesn't warrant the whole JS payload from being injected/run
2019-08-04 10:43:04 +02:00
Peter Ho 231100dc3c fix(iOS): Align look and feel of Window.prompt() to Mobile Safari (#677) 2019-08-02 11:00:05 +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
ptrocki 6e79f2a26f fix(iOS WKWebView): contentInset not properly applied (#603) 2019-06-02 20:54:17 +02:00
Penar Musaraj 4dc4b89e64 feat(iOS WkWebview): Add applicationNameForUserAgent support (#506) 2019-05-21 00:01:22 +02:00
Jared Forsyth e4c8dab2ae feat(onScroll): Add `onScroll` callback for iOS & Android (#516)
* Add `onScroll` callback for iOS & Android

This code was mostly extracted from https://github.com/react-native-community/react-native-webview/pull/202

I tried and tried to make it work with `Animated.event`'s `useNativeDriver`, but I was unsuccessful 😢 that'll have to be done later once I understand better how Animated's native stuff is hooked up.

* fix crash for missing onScroll
2019-05-17 00:27:16 +02:00
Eric Lewis c2914a8d73 fix(WKWebView): StatusBar is gone after fullscreen (iOS 12) (#544)
fixes #62
2019-04-30 10:08:41 +02:00
Eric Lewis 455c30e000 feat(WKWebView): Allow focus without user interaction (#540)
* [iOS] Allow focus without user interaction

* Add documentation for keyboardDisplayRequiresUserAction

* set keyboardDisplayRequiresUserAction default to true
2019-04-29 17:46:07 +02:00
TMomemt 7a91221926 fix(WKWebView): iOS crash when WebView's title is nil (#521) 2019-04-23 11:16:04 +02:00
SebiVPS cdbfc19cd2 feat(iOS cookies): implement sharedCookiesEnabled prop for iOS RNCWKWebView (#175)
We had the problem on iOS WebViews that local cookies (stored in local HTTPCookieStorage, set with  [react-native-cookie](https://github.com/shimohq/react-native-cookie) ) were not added in loadRequests. On Android the local stored cookies were sent like expected.
This kinda "hacky" solution is the only way we found, that works for us.
The stack overview link is in the code below.
If someone finds a better solution we would very much like to accept that.
2019-04-15 10:19:10 +02:00
jimerino 9c9b7d721a fix(iOS WKWebView): fixed local html files loading on real devices (#403) 2019-04-02 15:46:00 +02:00
Jian Wei 08cc600eb8 feat(WKWebView): add prop `directionalLockEnabled` for iOS (#389) 2019-03-07 10:27:29 +01:00
Thibault Malbranche 2cef5cbb3f
fix(WKWebView Scrolling): fixed broken scroll (#372)
fixes #371
2019-03-01 10:46:53 +01:00
Chet Corcos 0e6e92a7f1 fix(WKWebview Scroll): Don't allow the scrollView to scroll when `scrollEnabled={false}`. (#158)
* Don't allow the scrollview to scroll the WebView body.

* Readme comment

* Remove duplicate protocol def
2019-02-28 22:01:42 +01:00
Christoph Jerolimov f27f13e931 fix(WKWebView): resolved crash with WebKit on iOS 9.x. (#342)
This PR fixes two crashes when enableWebKit is true (which was the default) on iOS 9.x. The first one when the WebView component was mounted (fixes issue #150) and the second one, when the component was unmounted (fixes issue #213).

The first problem happen when the RNCWKWebView.m was loaded:

The programming guide for WebKit (version 2006) ([pdf](http://mirror.informatimago.com/next/developer.apple.com/documentation/Cocoa/Conceptual/DisplayWebContent/WebKit_DisplayWebContent.pdf)) from Apple said, that it is (was) required to check if the 'new' WebKit Framework was available. This was required when the WebKit framework was only available on Mac OS X (10.2) when the Safari was installed. 😆

Because WebKit is (currently..) a fix part of iOS we didn't need this check this anymore to determinate if WebKit is available. I also see no other reference that this is required in iOS so I just remove this code. Without this code the WebView works also on iOS 9.x.

The second issue happen when the WKWebView was removed from the native view hierarchy. Its required (only on iOS 9) to remove the UIScrollView delegate before cleaning up the webview.

Its possible to try this PR with:

```
npm install --save "react-native-webview@jerolimov/react-native-webview#fix-ios9-crash"
# or
yarn add "react-native-webview@jerolimov/react-native-webview#fix-ios9-crash"
```

If you use CocoaPods, you should also update your Pods with

```
cd ios && pod update && cd ..
```
2019-02-14 15:18:15 +01:00
Jordan Sexton 92c20581ae feat(toggle scroll bar): added new props showsVerticalScrollIndicator / showsHorizontalScrollIndicator (#250) 2019-02-12 14:47:24 +01:00
Maosen Jason Hu fc5fd242e2 feat(wkwebview): create api to allow clients to present a client credential for authentication (#141)
* In order for TLS Mutual Auth to work for webviews, the caller must present a credential. Expose a setter that can be called to set a credential.
2019-02-12 10:35:14 +01:00
Alexander Stammbach 3f58b0e597 fix(WKWebView.m): Reapplied #134 with additional checks to tackle unintentional scrolls (#296) 2019-02-06 15:29:59 +01:00
Thibault Malbranche d5fc028383 fix(PostMessage): Renamed ReactNativeWebview to ReactNativeWebView
fixes #304
2019-02-01 22:04:11 +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
Benjos Antony 6643a8e38d feat(WKwebview): Allow _target links to be opened up in the same way as UIWebView. (#270)
Fixes #139
2019-02-01 02:18:02 +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
Chet Corcos 4bc1dc20fd fix(WKWebview): Update webview property when allowsBackForwardNavigationGestures prop changes (#173) 2019-01-11 19:53:55 +01:00
José Luis Pereira 6f612242fe fix(WKWebView): Add "Frame load interrupted" error handling for OAuth (#147) 2019-01-11 15:01:49 +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
kylemantesso afadc62ada feat(WKWebview): Add shared process pool so cookies and localStorage are shared across webviews in iOS (#138)
* fix(WKWebview): [iOS] Add shared process pool so cookies and localStorage are shared across webviews (#68)

* Add optional shared process pool

BREAKING CHANGE: useSharedProcessPool prop is set to true by default. If you want the old behavior, please use useSharedProcessPool={false}
2019-01-07 15:19:32 +01:00
Ryan Linton 9f37ddea61 fix(WKWebview): Reverts #134, fixes issue where keyboard dismiss would scroll to top (#210) 2018-12-14 15:01:58 -08: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
npm-ued 41d9bdcce4 fix(WKWebview): Fixed non-working iOS alert. (#188) 2018-12-14 11:18:48 +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
Neil 2b9292ed1c fix(WKWebView): Fix the message handle bug. (#143)
* fix webview always recreate

* fix webview always recreate

* code format

* Update RNCWKWebView.m

* @bugfix fix the message handle problem
2018-11-20 01:48:26 +01:00
Tom 5425039ff4 feat(WKWebview): Add fix for keyboard dismiss leaving viewport shifted in iOS 12 (#134) 2018-11-19 11:21:36 +01:00
ifsnow c0c0116c80 fix(WKWebview): Fixed for supporting mediaPlaybackRequiresUserAction option under iOS 10. (#129) 2018-11-19 11:17:57 +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
Bae Hyeonseung 7f35344632 feat(WKWebview): [iOS] Add 'allowsBackForwardNavigationGestures' property (#97) 2018-10-21 23:12:59 +02:00
Neil 3c4f78df2e feat(WKWebView): Fix recreate bug when moving to window (#84)
* Fixes #81 
* Fixes #72
2018-10-18 08:34:00 +02: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
黎明 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