Skip to content

Accept grad and turn units in the hue-rotate() filter - #59740

Open
hsusul wants to merge 2 commits into
react:mainfrom
hsusul:fix/filter-hue-rotate-angle-units
Open

hsusul wants to merge 2 commits into
react:mainfrom
hsusul:fix/filter-hue-rotate-angle-units

Conversation

@hsusul

@hsusul hsusul commented Nov 1, 2026

Copy link
Copy Markdown

Summary:

hue-rotate() takes a CSS angle: deg, grad, rad, or turn. processFilter accepts deg and rad. grad and turn return undefined, so the whole filter list becomes [].

This change converts grad as 360/400 degrees and turn as 360 degrees. deg, rad, unitless 0, and unknown units stay the same. The native CSS angle parser already uses the same factors (grad is value * 0.9, turn is value * 360).

Open PR #59138 still has testUnitFilter('hue-rotate', 1.5, 'grad', []) in its new processBackdropFilter-itest.js.

Changelog:

[GENERAL] [FIXED] - filter: hue-rotate() now accepts grad and turn angle units instead of dropping the whole filter

Test Plan:

processFilter-itest.js expects hue-rotate(100grad) to be 90 degrees, 0.5turn to be 180 degrees, -0.25turn to be -90 degrees, and 1foo to be dropped.

Fantom and native builds were not run locally. CI will run them. ANDROID_SDK_ROOT and ANDROID_HOME are unset, so yarn fantom was not run. processFilter is pure JS, so the itest was run under Jest. A throwaway wrapper stubs @react-native/fantom/src/setUpDefaultReactNativeEnvironment and requires the itest. That wrapper is not in this PR.

On the fix commit's parent (384b4409c5), these cases failed:

  • hue-rotate(100grad)
  • string hue-rotate(100grad)
  • hue-rotate(0.5turn)
  • string hue-rotate(0.5turn)
  • hue-rotate(-0.25turn)
  • string hue-rotate(-0.25turn)

Result: 6 failed, 116 passed, 122 total.

On head (7ff64de6b7) those six cases passed. Result: 122 passed, 122 total.

Also ran:

  • yarn eslint --max-warnings 0 on processFilter.js and processFilter-itest.js (exit 0)
  • yarn prettier --check on those same files (exit 0)
  • yarn flow-check (Found 0 errors)

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 1, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 1, 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

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant