Support light/dark mode toggling via Emulation.setEmulatedMedia (#56510)#56510
Closed
huntie wants to merge 1 commit intofacebook:mainfrom
Closed
Support light/dark mode toggling via Emulation.setEmulatedMedia (#56510)#56510huntie wants to merge 1 commit intofacebook:mainfrom
huntie wants to merge 1 commit intofacebook:mainfrom
Conversation
|
@huntie has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101624433. |
…book#56510) Summary: Implements the `Emulation.setEmulatedMedia` CDP method in `jsinspector-modern`, scoped to `prefers-color-scheme` emulation. This allows CDP clients to toggle the app color scheme for debugging and visual verification. **Implementation notes** Adds a new `EmulationAgent` CDP domain agent that validates the `features` param, rejects unsupported media features/types, and delegates to `HostTargetDelegate::onSetEmulatedMedia`. Platform delegates: - **Android**: Calls `AppCompatDelegate.setDefaultNightMode()` on the UI thread via JNI through `ReactHostImpl`. - **iOS**: Sets `overrideUserInterfaceStyle` on the key `UIWindow`. Both platforms trigger their existing `Appearance` change event propagation to JS automatically. Changelog: [General][Added] - **React Native DevTools**: Add support for light/dark mode emulation via `Emulation.setEmulatedMedia` Reviewed By: hoxyq Differential Revision: D101624433
d3d28ed to
c006b62
Compare
|
This pull request has been merged in 11a5432. |
Collaborator
|
This pull request was successfully merged by @huntie in 11a5432 When will my fix make it into a release? | How to file a pick request? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Implements the
Emulation.setEmulatedMediaCDP method injsinspector-modern, scoped toprefers-color-schemeemulation. This allows CDP clients to toggle the app color scheme for debugging and visual verification.Implementation notes
Adds a new
EmulationAgentCDP domain agent that validates thefeaturesparam, rejects unsupported media features/types, and delegates toHostTargetDelegate::onSetEmulatedMedia. Platform delegates:AppCompatDelegate.setDefaultNightMode()on the UI thread via JNI throughReactHostImpl.overrideUserInterfaceStyleon the keyUIWindow.Both platforms trigger their existing
Appearancechange event propagation to JS automatically.Changelog:
[General][Added] - React Native DevTools: Add support for light/dark mode emulation via
Emulation.setEmulatedMediaReviewed By: hoxyq
Differential Revision: D101624433