From 70d9b56d717a13450d3e18ccb62bcfcb71cf4008 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 30 Dec 2022 01:45:18 -0800 Subject: [PATCH] Fix Catalyst @availablity checks in RCTPullToRefreshViewComponentView.mm (#35673) Summary: Judging from the original [commit](https://github.com/facebook/react-native/commit/4c4948b6e83208cd517dd977b3462b1959505e1d), the availability check is probably for Catalyst, not macOS. That matches the [apple documentation](https://developer.apple.com/documentation/uikit/uiscrollview/2127691-refreshcontrol?language=objc) as well (though we need 13.1, not 13). To avoid needing to introduce a diff in React Native macOS (where we actually compile for macOS and not Mac Catalyst) let's fix the availability check to be more accurate. Changing `macOS` to `MacCatalyst` should be supported as per https://docs.swift.org/swift-book/ReferenceManual/Attributes.html#ID348 (https://github.com/facebook/react-native/commit/2c5a966054c2a80d63aa9c2c2a234a80a02918cf) ## Changelog [IOS] [FIXED] - Fixed Mac Catalyst availability checks Pull Request resolved: https://github.com/facebook/react-native/pull/35673 Test Plan: Code compiles Reviewed By: christophpurrer Differential Revision: D42149589 Pulled By: cipolleschi fbshipit-source-id: fbbd31cba44f55215f2c4c0f37aad410d5bcd627 --- .../ScrollView/RCTPullToRefreshViewComponentView.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm index b897d8a8e8b0c8..9480239051e8be 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm @@ -132,7 +132,7 @@ - (void)_attach return; } - if (@available(macOS 13.0, *)) { + if (@available(macCatalyst 13.1, *)) { _scrollViewComponentView.scrollView.refreshControl = _refreshControl; } } @@ -146,7 +146,7 @@ - (void)_detach // iOS requires to end refreshing before unmounting. [_refreshControl endRefreshing]; - if (@available(macOS 13.0, *)) { + if (@available(macCatalyst 13.1, *)) { _scrollViewComponentView.scrollView.refreshControl = nil; } _scrollViewComponentView = nil;