Skip to content

Commit 31185eb

Browse files
committed
fix: properly retrieve window when clicking DevMenu action (#95)
1 parent 4599faf commit 31185eb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/react-native/React/CoreModules/RCTDevMenu.mm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,15 @@ - (RCTDevMenuAlertActionHandler)alertActionHandlerForDevItem:(RCTDevMenuItem *__
424424
{
425425
return ^(__unused UIAlertAction *action) {
426426
if (item) {
427+
#if TARGET_OS_VISION
428+
/// Execute this handler after the action sheet is dismissed to properly retrieve window when using SwiftUI entry point.
429+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0), dispatch_get_main_queue(), ^{
430+
[item callHandler];
431+
});
432+
#else
427433
[item callHandler];
434+
#endif
428435
}
429-
430436
self->_actionSheet = nil;
431437
};
432438
}

0 commit comments

Comments
 (0)