Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion packages/react-native/React/CoreModules/RCTActionSheetManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@

using namespace facebook::react;

// With popover action sheet, cancel button disappears with style = UIAlertActionStyleCancel
// Reverting to default style when:
// - building with SDK 26+ AND running on iOS 26+ AND UIDesignRequiresCompatibility is disabled
// - running on iPad
static inline UIAlertActionStyle RCTActionStyleForCancelButton(void)
{
if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
return UIAlertActionStyleDefault;
}

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 260000
if (@available(iOS 26, *)) {
if ([[[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIDesignRequiresCompatibility"] boolValue]) {
return UIAlertActionStyleCancel;
}

return UIAlertActionStyleDefault;
}
#endif
return UIAlertActionStyleCancel;
}

@interface RCTActionSheetManager () <NativeActionSheetManagerSpec>

@property (nonatomic, strong) NSMutableArray<UIAlertController *> *alertControllers;
Expand Down Expand Up @@ -154,7 +176,7 @@ - (void)presentViewController:(UIViewController *)alertController
if ([destructiveButtonIndices containsObject:@(index)]) {
style = UIAlertActionStyleDestructive;
} else if (index == cancelButtonIndex) {
style = UIAlertActionStyleCancel;
style = RCTActionStyleForCancelButton();
isCancelButtonIndex = true;
}

Expand Down
Loading