From dbf46593fa542101ffb0f67bf89a3c8ffd1755dd Mon Sep 17 00:00:00 2001 From: Brandon Lax <35619281+bralax@users.noreply.github.com> Date: Mon, 5 Oct 2020 11:14:42 -0400 Subject: [PATCH] fix(macOS): Don't include iOS pull-to-refresh control (#1636) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- apple/RNCWebView.h | 4 ++++ apple/RNCWebView.m | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apple/RNCWebView.h b/apple/RNCWebView.h index c2df02e..d761c33 100644 --- a/apple/RNCWebView.h +++ b/apple/RNCWebView.h @@ -64,7 +64,9 @@ @property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch; @property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL; @property (nonatomic, assign) BOOL pullToRefreshEnabled; +#if !TARGET_OS_OSX @property (nonatomic, weak) UIRefreshControl * refreshControl; +#endif #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */ @property (nonatomic, assign) WKContentMode contentMode; @@ -78,7 +80,9 @@ - (void)goBack; - (void)reload; - (void)stopLoading; +#if !TARGET_OS_OSX - (void)addPullToRefreshControl; - (void)pullToRefresh:(UIRefreshControl *)refreshControl; +#endif @end diff --git a/apple/RNCWebView.m b/apple/RNCWebView.m index 6e0ed7e..02005db 100644 --- a/apple/RNCWebView.m +++ b/apple/RNCWebView.m @@ -1136,7 +1136,7 @@ static NSDictionary* customCertificatesForHost; [_webView reload]; } } - +#if !TARGET_OS_OSX - (void)addPullToRefreshControl { UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; @@ -1151,7 +1151,7 @@ static NSDictionary* customCertificatesForHost; [refreshControl endRefreshing]; } -#if !TARGET_OS_OSX + - (void)setPullToRefreshEnabled:(BOOL)pullToRefreshEnabled { _pullToRefreshEnabled = pullToRefreshEnabled;