Skip to content

fix(theme): replace arrays when useTheme and withTheme merge a theme - #5317

Open
Priyanshu0007 wants to merge 1 commit into
callstack:mainfrom
Priyanshu0007:fix/theme-hook-array-merge
Open

Priyanshu0007 wants to merge 1 commit into
callstack:mainfrom
Priyanshu0007:fix/theme-hook-array-merge

Conversation

@Priyanshu0007

Copy link
Copy Markdown

Motivation

useTheme(overrides) and withTheme joined arrays, so an easing override gave 8 numbers and did nothing. They now replace arrays, like ThemeProvider and the theme prop.

Related issue

Fixes #5311

Screenshots / Videos

Before / after on web, iOS, Android:

issue-5311-before-android.mp4
issue-5311-before-web.mp4
issue-5311-after-android.mp4
issue-5311-before-ios.mp4
issue-5311-after-ios.mp4
issue-5311-after-web.mp4

Test plan

Call useTheme({ motion: { easing: { standard: [0.9, 0, 0.1, 1] } } }), or pass that theme to a withTheme component. The curve has those 4 numbers.

useTheme(overrides) and withTheme merged with deepmerge from
@callstack/react-theme-provider, which joins arrays. An easing override
gave 8 numbers and had no effect. Both now merge with safeMerge, as
ThemeProvider, PaperProvider and the theme prop do, so arrays are
replaced and platform colors are kept as they are.

Fixes callstack#5311
@Doberjohn Doberjohn added this to the 6.1.0 milestone Nov 24, 2026

This branch has not been deployed

No deployments
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.

useTheme(overrides) and withTheme concatenate arrays, so an easing override is ignored

2 participants