microsoft / microsoft/react-native-windows
Reconcile AppTheme's high contrast APIs with Lean Core Appearance APIs
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 17.3k
- Forks
- 1.2k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 33
Description
Align AppTheme API with Lean Core Appearance API
We have a Windows-only API module called AppTheme. Which enables you to listen to the dark and light theme state changes for Windows.
As of this commit, React Native core has an iOS and Android ones. It operates very similarly to how ours does, but there are some API name changes.
This proposal is to align the names with the Lean Core implementation, so that we can push up the Windows theme changed event work up to React Native to sit along side the iOS and Android implementations.
Summary
We must make sure our Windows implementation of the theme changed event maps to the React Native Appearance and the getColorScheme() function, instead of AppTheme and the currentTheme string property.
We should also separately PR the highContrastedChanged work into the Appearance API to enable support for that type of theme change.
Motivation
In order for our Windows implementation of theme changed events to work properly in React Native's lean core, we must align with their implementation of theme changed events.
This Windows alignment is happening on the JS-layer only.
The JS API to align with can be found in the Libraries/Utilities/Appearance.js file on the React Native repo.
Basic example
import { Appearance } from 'react-native'
render() {
return (
<Button title='click me' color={Appearance.getColorScheme() === 'dark' ? 'grey' : 'orange'}></Button>
);
}
Contributing Back
As mentioned above, it's important that during this alignment that we do not lose the highContrastedChanged implemented within AppTheme. This is an important feature for windows users and something we should contribute back to React Native core with.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with React Native's Libraries/Utilities/Appearance.js and search the Windows implementation for AppTheme, currentTheme, and highContrastedChanged. Align the Windows JavaScript API with Appearance and getColorScheme while preserving high-contrast change support; done means the Windows theme-change behavior uses the aligned names without losing that feature.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- desktop, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100