Skip to content

Commit

Permalink
Fix Catalyst @availablity checks in RCTPullToRefreshViewComponentView…
Browse files Browse the repository at this point in the history
….mm (#35673)

Summary:
Judging from the original [commit](4c4948b), 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 (2c5a966)

## Changelog

[IOS] [FIXED] - Fixed Mac Catalyst availability checks

Pull Request resolved: #35673

Test Plan: Code compiles

Reviewed By: christophpurrer

Differential Revision: D42149589

Pulled By: cipolleschi

fbshipit-source-id: fbbd31cba44f55215f2c4c0f37aad410d5bcd627
  • Loading branch information
Saadnajmi authored and facebook-github-bot committed Dec 30, 2022
1 parent 29a0791 commit 70d9b56
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ - (void)_attach
return;
}

if (@available(macOS 13.0, *)) {
if (@available(macCatalyst 13.1, *)) {
_scrollViewComponentView.scrollView.refreshControl = _refreshControl;
}
}
Expand All @@ -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;
Expand Down

0 comments on commit 70d9b56

Please sign in to comment.