Skip to content

feat: add DynamicTheme using PlatformColor#4901

Merged
adrcotfas merged 7 commits intov6from
@adrcotfas/feat/dynamic_theme
Apr 29, 2026
Merged

feat: add DynamicTheme using PlatformColor#4901
adrcotfas merged 7 commits intov6from
@adrcotfas/feat/dynamic_theme

Conversation

@adrcotfas
Copy link
Copy Markdown
Collaborator

@adrcotfas adrcotfas commented Apr 15, 2026

Motivation

  • This PR replaces the use of the native moduleExpo Material 3 Theme with a PlatformColor implementation.
    See https://reactnative.dev/docs/platformcolor.
  • State opacity values were updated to the specs; the reference theme elevation colors now use the correct neutral tones. See https://m3.material.io/blog/tone-based-surface-color-m3.
  • Since PlatformColor does not support applying an alpha, certain components like Button or Checkbox requiring this were updated to use opacity instead.
  • Other components using alpha like Chip were updated to use the state layers implementation as per specs.
  • The disabled version of the FAB was removed for two reasons: 1. MD3 specs state that a FAB does not have a disabled state and should be hidden instead; 2. It was using alpha and having this together with PlatformColor is not compatible.
  • surfaceDisabled, onSurfaceDisabled and backdrop which were not part of the MD standard were removed/replaced
  • This PR together with fix(MD3): update color schema and tokens  #4900 are the first steps required to modernize Paper to the latest MD3 specs.

Order of merging:

Related issue

#4893

Test plan

Run the Example app, enable Dynamic Colors from the drawer and switch the system theme: observe the app adapting to the device theme.

@github-actions
Copy link
Copy Markdown

The mobile version of example app from this branch is ready! You can see it here.

@adrcotfas adrcotfas force-pushed the @adrcotfas/fix/color_tokens branch from dacdfae to e888305 Compare April 29, 2026 11:00
Base automatically changed from @adrcotfas/fix/color_tokens to v6 April 29, 2026 11:20
xdimota7x and others added 7 commits April 29, 2026 15:39
* Known limitation: surface/container roles on API 31-33 use
* @color/m3_ref_palette_dynamic_neutral_variant* (MCL resources that require a
* native DynamicColors setup). No @android:color/ equivalent exists for those
* slots. Reference palette values are used as fallback on API 31-33.
for PlatformColor compatibility

* surfaceDisabled, onSurfaceDisabled and backdrop which were not part of the MD standard were removed
* the reference theme elevation colors now use the correct neutral tones; see https://m3.material.io/blog/tone-based-surface-color-m3
* replace usage of "alpha" with opacity or surface colors
* remove disabled FAB prop
@adrcotfas adrcotfas force-pushed the @adrcotfas/feat/dynamic_theme branch from 7e6e009 to 648aac9 Compare April 29, 2026 12:46
@callstack-bot
Copy link
Copy Markdown

Hey @adrcotfas, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@adrcotfas adrcotfas merged commit 8d9b6e1 into v6 Apr 29, 2026
3 checks passed
@adrcotfas adrcotfas deleted the @adrcotfas/feat/dynamic_theme branch April 29, 2026 12:51
adrcotfas added a commit that referenced this pull request Apr 29, 2026
* chore: remove md2 support

* fix: update colors as per material-components color tokens

* see https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/color/res/values/tokens.xml

* fix: update the color schema for LightTheme and DarkTheme

* see: https://m3.material.io/styles/color/roles

* feat: add DynamicTheme

* Known limitation: surface/container roles on API 31-33 use
* @color/m3_ref_palette_dynamic_neutral_variant* (MCL resources that require a
* native DynamicColors setup). No @android:color/ equivalent exists for those
* slots. Reference palette values are used as fallback on API 31-33.

* refactor: remove usage of expo-material3-theme

* refactor: rename "device colors" to "Dynamic Theme"

* feat: update Colors and stateOpacity tokens
for PlatformColor compatibility

* surfaceDisabled, onSurfaceDisabled and backdrop which were not part of the MD standard were removed
* the reference theme elevation colors now use the correct neutral tones; see https://m3.material.io/blog/tone-based-surface-color-m3
* replace usage of "alpha" with opacity or surface colors
* remove disabled FAB prop
This was referenced Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants