fix(macOS): Don't include iOS pull-to-refresh control (#1636)

* Update RNCWebView.h

Limit methods relating to pull to refresh to only iOS

* Update RNCWebView.m

Block methods relating to pull to refresh when the target is macOS as macOS does not have the UIRefreshControl

Co-authored-by: Eloy Durán <eloy.de.enige@gmail.com>
This commit is contained in:
Brandon Lax 2020-10-05 11:14:42 -04:00 committed by GitHub
parent f2041955a2
commit dbf46593fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -64,7 +64,9 @@
@property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch; @property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
@property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL; @property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
@property (nonatomic, assign) BOOL pullToRefreshEnabled; @property (nonatomic, assign) BOOL pullToRefreshEnabled;
#if !TARGET_OS_OSX
@property (nonatomic, weak) UIRefreshControl * refreshControl; @property (nonatomic, weak) UIRefreshControl * refreshControl;
#endif
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */ #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
@property (nonatomic, assign) WKContentMode contentMode; @property (nonatomic, assign) WKContentMode contentMode;
@ -78,7 +80,9 @@
- (void)goBack; - (void)goBack;
- (void)reload; - (void)reload;
- (void)stopLoading; - (void)stopLoading;
#if !TARGET_OS_OSX
- (void)addPullToRefreshControl; - (void)addPullToRefreshControl;
- (void)pullToRefresh:(UIRefreshControl *)refreshControl; - (void)pullToRefresh:(UIRefreshControl *)refreshControl;
#endif
@end @end

View File

@ -1136,7 +1136,7 @@ static NSDictionary* customCertificatesForHost;
[_webView reload]; [_webView reload];
} }
} }
#if !TARGET_OS_OSX
- (void)addPullToRefreshControl - (void)addPullToRefreshControl
{ {
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
@ -1151,7 +1151,7 @@ static NSDictionary* customCertificatesForHost;
[refreshControl endRefreshing]; [refreshControl endRefreshing];
} }
#if !TARGET_OS_OSX
- (void)setPullToRefreshEnabled:(BOOL)pullToRefreshEnabled - (void)setPullToRefreshEnabled:(BOOL)pullToRefreshEnabled
{ {
_pullToRefreshEnabled = pullToRefreshEnabled; _pullToRefreshEnabled = pullToRefreshEnabled;