Skip to content

Commit 8148893

Browse files
committed
fix: properly retrieve window when clicking DevMenu action (#95)
1 parent aa6202c commit 8148893

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
@@ -406,9 +406,15 @@ - (RCTDevMenuAlertActionHandler)alertActionHandlerForDevItem:(RCTDevMenuItem *__
406406
{
407407
return ^(__unused UIAlertAction *action) {
408408
if (item) {
409+
#if TARGET_OS_VISION
410+
/// Execute this handler after the action sheet is dismissed to properly retrieve window when using SwiftUI entry point.
411+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0), dispatch_get_main_queue(), ^{
412+
[item callHandler];
413+
});
414+
#else
409415
[item callHandler];
416+
#endif
410417
}
411-
412418
self->_actionSheet = nil;
413419
};
414420
}

0 commit comments

Comments
 (0)