Wrap UIMenuAutoFill in compilation pragmas for iOS 17 checks (#43808)

Summary:
PR https://github.com/facebook/react-native/issues/43468 landed in main which uses UIMenuAutoFill that is available only in iOS 17.
Despite having the `available` checks, these are only runtime checks. The symbol is not stripped on older versions of Xcode and therefore our jobs which uses older Xcode versions started failing.

This change wraps the offending code in a compilation pragma that strips away the symbol when building with Xcode versions that does not know iOS 17.

## Changelog:
[iOS][Fixed] - wrap UIMenuAutoFill in compilation checks for iOS 17

Pull Request resolved: https://github.com/facebook/react-native/pull/43808

Test Plan: CircleCI is green

Reviewed By: cortinico

Differential Revision: D55688255

Pulled By: cipolleschi

fbshipit-source-id: d69874b60e73da1fbdfc61d594870a48f97c3797
This commit is contained in:
Riccardo Cipolleschi authored and Facebook GitHub Bot committed 2024-04-03 04:45:30 -07:00
1 parent bcac3c4d9c
commit 1561cc9855
2 files changed
+10 -4

No files matched your search

@@ -269,11 +269,14 @@ static UIColor *defaultPlaceholderColor(void)
- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder
{
if (_contextMenuHidden) {
if (@available(iOS 17.0, *)) {
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000
if (@available(iOS 17.0, *)) {
if (_contextMenuHidden) {
[builder removeMenuForIdentifier:UIMenuAutoFill];
}
}
#endif
[super buildMenuWithBuilder:builder];
}
@@ -144,11 +144,14 @@
- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder
{
if (_contextMenuHidden) {
if (@available(iOS 17.0, *)) {
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000
if (@available(iOS 17.0, *)) {
if (_contextMenuHidden) {
[builder removeMenuForIdentifier:UIMenuAutoFill];
}
}
#endif
[super buildMenuWithBuilder:builder];
}