feat: add setUserInterfaceStyle API with local persistence#16
Merged
huhuanming merged 11 commits intomainfrom Feb 4, 2026
Merged
feat: add setUserInterfaceStyle API with local persistence#16huhuanming merged 11 commits intomainfrom
huhuanming merged 11 commits intomainfrom
Conversation
Add setUserInterfaceStyle(style) to react-native-device-utils for forcing light/dark/system theme. The style is persisted locally (UserDefaults on iOS, SharedPreferences on Android) and automatically restored on module initialization. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com>
Narrow style parameter type to 'light' | 'dark' | 'unspecified' union, fix iOS style application by deferring to next runloop and using modern connectedScenes API on iOS 15+, and fix Android by running night mode changes on UI thread and migrating to androidx.preference. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- iOS: remove redundant double DispatchQueue.main.async in restoreUserInterfaceStyle since applyUserInterfaceStyle already dispatches to main thread - Android: use Handler(Looper.getMainLooper()) to guarantee main thread execution regardless of Activity availability - Test page: fix spanning listener memory leak by saving listener ID and cleaning up on unmount via useEffect Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…otocol conformance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
originalix
approved these changes
Feb 3, 2026
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
setUserInterfaceStyle(style: string)API toreact-native-device-utilssupportinglight,dark, andunspecified(system default)UserDefaults, Android:SharedPreferences) and restore on app launchTest plan
🤖 Generated with Claude Code