Browse Source

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>
Brandon Lax 4 years ago
parent
commit
dbf46593fa
No account linked to committer's email address
2 changed files with 6 additions and 2 deletions
  1. 4
    0
      apple/RNCWebView.h
  2. 2
    2
      apple/RNCWebView.m

+ 4
- 0
apple/RNCWebView.h View File

@@ -64,7 +64,9 @@
64 64
 @property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
65 65
 @property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
66 66
 @property (nonatomic, assign) BOOL pullToRefreshEnabled;
67
+#if !TARGET_OS_OSX
67 68
 @property (nonatomic, weak) UIRefreshControl * refreshControl;
69
+#endif
68 70
 
69 71
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
70 72
 @property (nonatomic, assign) WKContentMode contentMode;
@@ -78,7 +80,9 @@
78 80
 - (void)goBack;
79 81
 - (void)reload;
80 82
 - (void)stopLoading;
83
+#if !TARGET_OS_OSX
81 84
 - (void)addPullToRefreshControl;
82 85
 - (void)pullToRefresh:(UIRefreshControl *)refreshControl;
86
+#endif
83 87
 
84 88
 @end

+ 2
- 2
apple/RNCWebView.m View File

@@ -1136,7 +1136,7 @@ static NSDictionary* customCertificatesForHost;
1136 1136
     [_webView reload];
1137 1137
   }
1138 1138
 }
1139
-
1139
+#if !TARGET_OS_OSX
1140 1140
 - (void)addPullToRefreshControl
1141 1141
 {
1142 1142
     UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
@@ -1151,7 +1151,7 @@ static NSDictionary* customCertificatesForHost;
1151 1151
     [refreshControl endRefreshing];
1152 1152
 }
1153 1153
 
1154
-#if !TARGET_OS_OSX
1154
+
1155 1155
 - (void)setPullToRefreshEnabled:(BOOL)pullToRefreshEnabled
1156 1156
 {
1157 1157
     _pullToRefreshEnabled = pullToRefreshEnabled;