From c5c5089f23f46c71585740d45c82c6363ac384aa Mon Sep 17 00:00:00 2001 From: Phillip Pan Date: Thu, 8 Feb 2024 07:25:10 -0800 Subject: [PATCH] fix C++ memory crash Summary: blocks don't capture C++ objects so this will would crash Changelog: [iOS][Internal] Reviewed By: sammy-SC, cipolleschi Differential Revision: D53572123 --- packages/react-native/React/CoreModules/RCTAlertManager.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/React/CoreModules/RCTAlertManager.mm b/packages/react-native/React/CoreModules/RCTAlertManager.mm index 674bc389a94086..415bb1f6fb838d 100644 --- a/packages/react-native/React/CoreModules/RCTAlertManager.mm +++ b/packages/react-native/React/CoreModules/RCTAlertManager.mm @@ -84,6 +84,7 @@ - (void)invalidate NSString *destructiveButtonKey = [RCTConvert NSString:args.destructiveButtonKey()]; NSString *preferredButtonKey = [RCTConvert NSString:args.preferredButtonKey()]; UIKeyboardType keyboardType = [RCTConvert UIKeyboardType:args.keyboardType()]; + UIUserInterfaceStyle userInterfaceStyle = [RCTConvert UIUserInterfaceStyle:args.userInterfaceStyle()]; if (!title && !message) { RCTLogError(@"Must specify either an alert title, or message, or both"); @@ -108,7 +109,6 @@ - (void)invalidate message:nil preferredStyle:UIAlertControllerStyleAlert]; - UIUserInterfaceStyle userInterfaceStyle = [RCTConvert UIUserInterfaceStyle:args.userInterfaceStyle()]; alertController.overrideUserInterfaceStyle = userInterfaceStyle; switch (type) {