-
Notifications
You must be signed in to change notification settings - Fork 149
[macOS] Add dev menu support for Fabric (new architecture) #2735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Saadnajmi <[email protected]>
Co-authored-by: Saadnajmi <[email protected]>
Co-authored-by: Saadnajmi <[email protected]>
|
@copilot can we remove any fallbacks to the bridge in this PR? |
Actually, keep them in the bridge adapter, but not SurfaceHostingView |
Co-authored-by: Saadnajmi <[email protected]>
Co-authored-by: Saadnajmi <[email protected]>
|
@copilot Can we not get the RCTDevMenu module in RCTSurfaceHostingView from the contect container? I don't think the notification approach will work well |
Co-authored-by: Saadnajmi <[email protected]>
Done! Updated to access RCTDevMenu from the contextContainer via the surface presenter. The implementation now returns the actual NSMenu (like Paper does) instead of using notifications, with a fallback to notifications if contextContainer access fails. Changes in commit 6506433. |
Summary
Implements dev menu support for Fabric (the new architecture's renderer) on macOS, enabling the right-click context menu to show the dev menu in Fabric-based apps.
Problem
In Paper (the legacy renderer), the dev menu was enabled on right-click via an override in
RCTRootView:However, Fabric (the new architecture) had no equivalent implementation in its view hierarchy, leaving users without dev menu access when using Fabric.
Solution
This PR adds dev menu support to Fabric with a clean architectural separation:
1. Bridge-independent view layer (
RCTSurfaceHostingView)Implemented
menuForEvent:inRCTSurfaceHostingView(Fabric's equivalent ofRCTRootView) that accesses DevMenu from the contextContainer:2. DevMenu in contextContainer (
RCTSurfacePresenterBridgeAdapter)Added DevMenu to the contextContainer in the bridge adapter layer, making it available to Fabric components:
Implementation Details
RCTSurfaceHostingViewaccesses DevMenu through the contextContainer, not directly via bridgeRCT_DEVguardsTesting
Manual testing required:
Fixes #2734
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.