Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Fix inherited animated text color on native#490

Open
yaminyassin wants to merge 1 commit into
react:mainfrom
yaminyassin:fix/426-inherited-color-transition
Open

Fix inherited animated text color on native#490
yaminyassin wants to merge 1 commit into
react:mainfrom
yaminyassin:fix/426-inherited-color-transition

Conversation

@yaminyassin

@yaminyassin yaminyassin commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #426.

Fixes inherited animated text color on native when a parent has a color transition and a child uses color: inherit.

The inherited style path already copied the resolved parent color into the child style, but it did not mark the child as needing an Animated renderer when the inherited value was animated. That meant a child text node could receive an animated color value while still rendering as regular Text instead of Animated.Text.

This updates inherited style resolution to detect inherited AnimatedNode values and set the internal animated flag so the native renderer selects the Animated component.

Why this happens

Transitions create animated style values with Animated.Value().interpolate(...).

For direct styles, the transition path already causes the component to render with an Animated renderer. The bug appears when the animated value is inherited:

  1. The parent computes an animated color.
  2. The child has color: inherit.
  3. useStyleProps resolves the inherited value and assigns it to the child style.
  4. Before this change, that inherited animated value did not mark the child style props as animated.
  5. The child rendered as plain Text, even though its color style was animated.

Why this fix

The native renderer needs to know whether the resolved style contains a real React Native animated node. So we add and export AnimatedNode from react-native.

The AnimatedNode deep import is wrapped through src/native/react-native, matching the existing convention for React Native internals.

Test plan

  • npm run jest --workspace react-strict-dom -- --selectProjects "react-strict-dom (Native)" tests/html/html-test.native.js --runInBand --watchman=false
  • npx flow focus-check packages/react-strict-dom/src/native/react-native/AnimatedNode.js packages/react-strict-dom/src/native/react-native/index.js packages/react-strict-dom/src/native/modules/useStyleProps.js packages/react-strict-dom/tests/html/html-test.native.js
  • npm run lint:report -- --quiet packages/benchmarks/perf/rollup.config.mjs packages/benchmarks/perf/mocks/react-native.js packages/benchmarks/perf/mocks/AnimatedNode.js
  • npm run build --workspace react-strict-dom
  • npm run perf --workspace benchmarks -- -o /tmp/rsd-perf-pr490.json
  • git diff --check origin/main...HEAD

@meta-cla meta-cla Bot added the cla signed label May 29, 2026
@yaminyassin yaminyassin force-pushed the fix/426-inherited-color-transition branch from 0d8d4f4 to 07a4bd8 Compare May 29, 2026 23:37
@yaminyassin yaminyassin force-pushed the fix/426-inherited-color-transition branch from 07a4bd8 to 36f0cf2 Compare May 29, 2026 23:41
@github-actions

Copy link
Copy Markdown

workflow: benchmarks/perf (native)

Comparison of performance test results, measured in operations per second. Larger is better.

Results Base Patch Ratio
css.create
· small 1,099,261 1,140,111 1.04 +
· small with units 487,639 504,311 1.03 +
· small with variables 652,354 663,668 1.02 +
· several small 342,532 356,858 1.04 +
· large 194,617 199,418 1.02 +
· large with polyfills 143,511 148,772 1.04 +
· complex 99,218 102,394 1.03 +
· unsupported 204,685 212,072 1.04 +
css.createTheme
· simple theme 224,219 225,976 1.01 +
· polyfill theme 214,178 213,069 0.99 -

@github-actions

Copy link
Copy Markdown

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.

Results Base Patch Ratio
react-strict-dom/dist/web/index.js
· compressed 3,251 3,251 1.00
· minified 10,375 10,375 1.00
react-strict-dom/dist/web/runtime.js
· compressed 1,645 1,645 1.00
· minified 4,131 4,131 1.00
react-strict-dom/dist/native/index.js
· compressed 16,618 16,648 1.00 +
· minified 64,626 64,798 1.00 +
react-strict-animated/dist/web/index.js
· compressed 6,861 6,861 1.00
· minified 23,486 23,486 1.00
react-strict-animated/dist/native/index.js
· compressed 797 797 1.00
· minified 2,518 2,518 1.00

@yaminyassin

yaminyassin commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

@martinbooth could you take a look at this? When could we expect a release if it merges?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Css transitionProperty breaking color inheritance in React Native

1 participant