File tree Expand file tree Collapse file tree 2 files changed +5
-32
lines changed
packages/react-native/React
Base/Surface/SurfaceHostingView Expand file tree Collapse file tree 2 files changed +5
-32
lines changed Original file line number Diff line number Diff line change @@ -287,25 +287,11 @@ - (NSMenu *)menuForEvent:(NSEvent *)event
287287{
288288 NSMenu *menu = nil ;
289289#if __has_include(<React/RCTDevMenu.h>) && RCT_DEV
290- // Try to get the dev menu from the bridge if available
291- // In Fabric with bridge mode, RCTSurface (but not RCTFabricSurface) has a bridge
292- if ([self .surface isKindOfClass: [RCTSurface class ]]) {
293- RCTSurface *surface = (RCTSurface *)self.surface ;
294- // Use performSelector to access the bridge since it's not a public property
295- if ([surface respondsToSelector: @selector (bridge )]) {
296- RCTBridge *bridge = [surface performSelector: @selector (bridge )];
297- if (bridge) {
298- menu = [[bridge devMenu ] menu ];
299- }
300- }
301- }
302-
303- // Fall back to notification-based approach for bridgeless mode or if bridge access failed
304- if (menu == nil ) {
305- [[NSNotificationCenter defaultCenter ] postNotificationName: RCTShowDevMenuNotification object: nil ];
306- // Return nil as the menu will be shown programmatically via notification
307- return nil ;
308- }
290+ // In Fabric/bridgeless mode, trigger the dev menu via notification
291+ // This is bridge-independent and works without accessing the bridge
292+ [[NSNotificationCenter defaultCenter ] postNotificationName: RCTShowDevMenuNotification object: nil ];
293+ // Return nil as the menu will be shown programmatically via notification
294+ return nil ;
309295#endif
310296
311297 if (menu == nil ) {
Original file line number Diff line number Diff line change 1818#import < React/RCTSurfacePresenter.h>
1919#import < React/RCTSurfacePresenterStub.h>
2020
21- #if __has_include(<React/RCTDevMenu.h>) && RCT_DEV
22- #import < React/RCTDevMenu.h>
23- #endif
24-
2521#import < ReactCommon/RuntimeExecutor.h>
2622#import < react/utils/ContextContainer.h>
2723#import < react/utils/ManagedObjectWrapper.h>
@@ -43,15 +39,6 @@ - (void)invokeAsync:(std::function<void()> &&)func;
4339
4440 contextContainer->insert (" Bridge" , wrapManagedObjectWeakly (bridge));
4541 contextContainer->insert (" RCTImageLoader" , wrapManagedObject ((id <RCTImageLoaderWithAttributionProtocol>)imageLoader));
46-
47- #if __has_include(<React/RCTDevMenu.h>) && RCT_DEV
48- // Add DevMenu to contextContainer for Fabric views to access
49- RCTDevMenu *devMenu = [bridge devMenu ];
50- if (devMenu) {
51- contextContainer->insert (" RCTDevMenu" , wrapManagedObject (devMenu));
52- }
53- #endif
54-
5542 return contextContainer;
5643}
5744
You can’t perform that action at this time.
0 commit comments