Skip to content

Commit 1561cc9

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Wrap UIMenuAutoFill in compilation pragmas for iOS 17 checks (facebook#43808)
Summary: PR facebook#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: facebook#43808 Test Plan: CircleCI is green Reviewed By: cortinico Differential Revision: D55688255 Pulled By: cipolleschi fbshipit-source-id: d69874b60e73da1fbdfc61d594870a48f97c3797
1 parent bcac3c4 commit 1561cc9

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,14 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender
269269

270270
- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder
271271
{
272-
if (_contextMenuHidden) {
273-
if (@available(iOS 17.0, *)) {
272+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000
273+
if (@available(iOS 17.0, *)) {
274+
if (_contextMenuHidden) {
274275
[builder removeMenuForIdentifier:UIMenuAutoFill];
275276
}
276277
}
278+
#endif
279+
277280
[super buildMenuWithBuilder:builder];
278281
}
279282

packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.mm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,14 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender
144144

145145
- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder
146146
{
147-
if (_contextMenuHidden) {
148-
if (@available(iOS 17.0, *)) {
147+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000
148+
if (@available(iOS 17.0, *)) {
149+
if (_contextMenuHidden) {
149150
[builder removeMenuForIdentifier:UIMenuAutoFill];
150151
}
151152
}
153+
#endif
154+
152155
[super buildMenuWithBuilder:builder];
153156
}
154157

0 commit comments

Comments
 (0)