Skip to content

Commit

Permalink
added support for allowsLinkPreview property
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisbronchart committed Jan 22, 2018
1 parent 1fbe945 commit 07e512a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ Set a custom user agent for WKWebView. Note this only works on iOS 9+. Previous

- **hideKeyboardAccessoryView**

This will hide the keyboard accesory view (`<` `>` and `Done`). Default is false.
This will hide the keyboard accessory view (`<` `>` and `Done`). Default is false.

- **allowsLinkPreview**

A Boolean value that determines whether pressing on a link displays a preview of the destination for the link. This props is available on devices that support 3D Touch. In iOS 10 and later, the default value is true; before that, the default value is false.

#### Communication from WKWebview to React Native

Expand Down
5 changes: 5 additions & 0 deletions WKWebView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ class WKWebView extends React.Component {
* backward compatible.
*/
hideKeyboardAccessoryView: PropTypes.bool,
/**
* A Boolean value that determines whether pressing on a link displays a preview of the destination for the link. This props is available on devices that support 3D Touch. In iOS 10 and later, the default value is true; before that, the default value is false.
*/
allowsLinkPreview: PropTypes.bool,
/**
* Sets the customized user agent by using of the WKWebView
*/
Expand Down Expand Up @@ -295,6 +299,7 @@ class WKWebView extends React.Component {
automaticallyAdjustContentInsets={this.props.automaticallyAdjustContentInsets}
openNewWindowInWebView={this.props.openNewWindowInWebView}
hideKeyboardAccessoryView={this.props.hideKeyboardAccessoryView}
allowsLinkPreview={this.props.allowsLinkPreview}
onLoadingStart={this._onLoadingStart}
onLoadingFinish={this._onLoadingFinish}
onLoadingError={this._onLoadingError}
Expand Down
1 change: 1 addition & 0 deletions ios/RCTWKWebView/RCTWKWebViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ - (UIView *)view
RCT_EXPORT_VIEW_PROPERTY(onMessage, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onScroll, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(hideKeyboardAccessoryView, BOOL)
RCT_REMAP_VIEW_PROPERTY(allowsLinkPreview, _webView.allowsLinkPreview, BOOL)

RCT_EXPORT_METHOD(goBack:(nonnull NSNumber *)reactTag)
{
Expand Down

0 comments on commit 07e512a

Please sign in to comment.