Skip to content

Commit d47cab6

Browse files
committed
fix: properly retrieve window when clicking DevMenu action (#95)
1 parent 08d4262 commit d47cab6

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
@@ -413,9 +413,15 @@ - (RCTDevMenuAlertActionHandler)alertActionHandlerForDevItem:(RCTDevMenuItem *__
413413
{
414414
return ^(__unused UIAlertAction *action) {
415415
if (item) {
416+
#if TARGET_OS_VISION
417+
/// Execute this handler after the action sheet is dismissed to properly retrieve window when using SwiftUI entry point.
418+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0), dispatch_get_main_queue(), ^{
419+
[item callHandler];
420+
});
421+
#else
416422
[item callHandler];
423+
#endif
417424
}
418-
419425
self->_actionSheet = nil;
420426
};
421427
}

0 commit comments

Comments
 (0)