feat(WKWebview): [ios] Add 'pagingEnabled' property to the iOS WKWebview (#165)
This commit is contained in:
parent
f79b7133c1
commit
4870e1f06a
|
@ -46,6 +46,7 @@ This document lays out the current public properties and methods for the React N
|
||||||
- [`allowsBackForwardNavigationGestures`](Reference.md#allowsbackforwardnavigationgestures)
|
- [`allowsBackForwardNavigationGestures`](Reference.md#allowsbackforwardnavigationgestures)
|
||||||
- [`allowFileAccess`](Reference.md#allowFileAccess)
|
- [`allowFileAccess`](Reference.md#allowFileAccess)
|
||||||
- [`saveFormDataDisabled`](Reference.md#saveFormDataDisabled)
|
- [`saveFormDataDisabled`](Reference.md#saveFormDataDisabled)
|
||||||
|
- [`pagingEnabled`](Reference.md#pagingEnabled)
|
||||||
|
|
||||||
## Methods Index
|
## Methods Index
|
||||||
|
|
||||||
|
@ -517,6 +518,16 @@ Sets whether the WebView should disable saving form data. The default value is `
|
||||||
| ------- | -------- | -------- |
|
| ------- | -------- | -------- |
|
||||||
| boolean | No | Android |
|
| boolean | No | Android |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `pagingEnabled`
|
||||||
|
|
||||||
|
If the value of this property is true, the scroll view stops on multiples of the scroll view’s bounds when the user scrolls. The default value is false.
|
||||||
|
|
||||||
|
| Type | Required | Platform |
|
||||||
|
| ------- | -------- | -------- |
|
||||||
|
| boolean | No | iOS |
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
### `extraNativeComponentConfig()`
|
### `extraNativeComponentConfig()`
|
||||||
|
|
|
@ -26,6 +26,7 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
|
||||||
@property (nonatomic, assign) BOOL messagingEnabled;
|
@property (nonatomic, assign) BOOL messagingEnabled;
|
||||||
@property (nonatomic, copy) NSString *injectedJavaScript;
|
@property (nonatomic, copy) NSString *injectedJavaScript;
|
||||||
@property (nonatomic, assign) BOOL scrollEnabled;
|
@property (nonatomic, assign) BOOL scrollEnabled;
|
||||||
|
@property (nonatomic, assign) BOOL pagingEnabled;
|
||||||
@property (nonatomic, assign) CGFloat decelerationRate;
|
@property (nonatomic, assign) CGFloat decelerationRate;
|
||||||
@property (nonatomic, assign) BOOL allowsInlineMediaPlayback;
|
@property (nonatomic, assign) BOOL allowsInlineMediaPlayback;
|
||||||
@property (nonatomic, assign) BOOL bounces;
|
@property (nonatomic, assign) BOOL bounces;
|
||||||
|
|
|
@ -111,6 +111,7 @@ static NSString *const MessageHanderName = @"ReactNative";
|
||||||
_webView.UIDelegate = self;
|
_webView.UIDelegate = self;
|
||||||
_webView.navigationDelegate = self;
|
_webView.navigationDelegate = self;
|
||||||
_webView.scrollView.scrollEnabled = _scrollEnabled;
|
_webView.scrollView.scrollEnabled = _scrollEnabled;
|
||||||
|
_webView.scrollView.pagingEnabled = _pagingEnabled;
|
||||||
_webView.scrollView.bounces = _bounces;
|
_webView.scrollView.bounces = _bounces;
|
||||||
[_webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil];
|
[_webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil];
|
||||||
_webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
|
_webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
|
||||||
|
|
|
@ -45,6 +45,7 @@ RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(hideKeyboardAccessoryView, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(hideKeyboardAccessoryView, BOOL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(allowsBackForwardNavigationGestures, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(allowsBackForwardNavigationGestures, BOOL)
|
||||||
|
RCT_EXPORT_VIEW_PROPERTY(pagingEnabled, BOOL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(userAgent, NSString)
|
RCT_EXPORT_VIEW_PROPERTY(userAgent, NSString)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -269,6 +269,7 @@ class WebView extends React.Component<WebViewSharedProps, State> {
|
||||||
injectedJavaScript={this.props.injectedJavaScript}
|
injectedJavaScript={this.props.injectedJavaScript}
|
||||||
bounces={this.props.bounces}
|
bounces={this.props.bounces}
|
||||||
scrollEnabled={this.props.scrollEnabled}
|
scrollEnabled={this.props.scrollEnabled}
|
||||||
|
pagingEnabled={this.props.pagingEnabled}
|
||||||
decelerationRate={decelerationRate}
|
decelerationRate={decelerationRate}
|
||||||
contentInset={this.props.contentInset}
|
contentInset={this.props.contentInset}
|
||||||
automaticallyAdjustContentInsets={
|
automaticallyAdjustContentInsets={
|
||||||
|
|
|
@ -168,6 +168,14 @@ export type IOSWebViewProps = $ReadOnly<{|
|
||||||
*/
|
*/
|
||||||
scrollEnabled?: ?boolean,
|
scrollEnabled?: ?boolean,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the value of this property is true, the scroll view stops on multiples
|
||||||
|
* of the scroll view’s bounds when the user scrolls.
|
||||||
|
* The default value is false.
|
||||||
|
* @platform ios
|
||||||
|
*/
|
||||||
|
pagingEnabled?: ?boolean,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount by which the web view content is inset from the edges of
|
* The amount by which the web view content is inset from the edges of
|
||||||
* the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
|
* the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
|
||||||
|
|
|
@ -145,6 +145,14 @@ export interface IOSWebViewProps {
|
||||||
*/
|
*/
|
||||||
scrollEnabled?: boolean;
|
scrollEnabled?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the value of this property is true, the scroll view stops on multiples
|
||||||
|
* of the scroll view’s bounds when the user scrolls.
|
||||||
|
* The default value is false.
|
||||||
|
* @platform ios
|
||||||
|
*/
|
||||||
|
pagingEnabled?: boolean,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount by which the web view content is inset from the edges of
|
* The amount by which the web view content is inset from the edges of
|
||||||
* the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
|
* the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
|
||||||
|
|
Loading…
Reference in New Issue