From b796cda38b78abbadc5007c3fc9730fbb7d59230 Mon Sep 17 00:00:00 2001 From: Phillip Pan Date: Thu, 8 Feb 2024 12:24:48 -0800 Subject: [PATCH] fix crash Summary: blocks don't capture C++ objects so this will would crash Reviewed By: sammy-SC, cipolleschi Differential Revision: D53572123 fbshipit-source-id: 323f29c30d99616080aef6b0a895df4599788395 --- 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 674bc389a94..415bb1f6fb8 100644 --- a/packages/react-native/React/CoreModules/RCTAlertManager.mm +++ b/packages/react-native/React/CoreModules/RCTAlertManager.mm @@ -84,6 +84,7 @@ RCT_EXPORT_METHOD(alertWithArgs : (JS::NativeAlertManager::Args &)args callback 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 @@ RCT_EXPORT_METHOD(alertWithArgs : (JS::NativeAlertManager::Args &)args callback message:nil preferredStyle:UIAlertControllerStyleAlert]; - UIUserInterfaceStyle userInterfaceStyle = [RCTConvert UIUserInterfaceStyle:args.userInterfaceStyle()]; alertController.overrideUserInterfaceStyle = userInterfaceStyle; switch (type) {