Skip to content

Apply Android color matrix filters in the order written - #60347

Open
lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-60333-color-filter-order
Open

lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-60333-color-filter-order

Conversation

@lazerg

@lazerg lazerg commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Summary:

On Android, a filter list made only of color functions was applied last to first, so [{invert: 1}, {sepia: 1}] drew as sepia then invert. FilterHelper.parseColorMatrixFilters folds the list into one ColorMatrix with preConcat, and preConcat(m) runs m before what's already in the matrix. This switches it to postConcat, so each function runs after the ones written before it, like CSS and like the RenderEffect path that lists with blur or dropShadow already take.

Fixes #60333

Changelog:

[ANDROID] [FIXED] - filter lists with only color functions are now applied in the order written instead of reversed

Test Plan:

Added FilterHelperTest with an [invert(1), sepia(1)] case that checks a red pixel comes out as about rgb(244, 218, 170). It fails on main (red is 154.8, the reversed result from the issue) and passes with this change. ./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest passes and yarn format-check-kotlin is clean. I didn't run the reproducer on a device.

@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 27, 2026
@github-actions github-actions Bot added the Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. label Nov 27, 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 27, 2026
@github-actions

Copy link
Copy Markdown

Visual regression

No visual differences at 6fbd82bfce91.

ios: no capture

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. Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. 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.

Android: a filter list of colour functions alone is drawn in reverse order, so [{invert: 1}, {sepia: 1}] draws as sepia then invert

1 participant