Skip to content

Keep earlier filters when a blur in the filter list is too small to draw - #60345

Merged
intergalacticspacehighway merged 2 commits into
react:mainfrom
lazerg:fix/issue-60341-blur-filter-chain
Nov 29, 2026
Merged

intergalacticspacehighway merged 2 commits into
react:mainfrom
lazerg:fix/issue-60341-blur-filter-chain

Conversation

@lazerg

@lazerg lazerg commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Summary:

On Android 12+, FilterHelper.createBlurEffect returns null for a blur sigma of 0.5 or less, and parseFilters stores that result as the whole RenderEffect chain. So [{grayscale: 1}, {blur: 0}] draws the view unfiltered, and [{invert: 1}, {blur: 0.5}, {sepia: 1}] draws it with only the sepia. A blur that draws nothing should leave the image as it is, so it now returns the incoming chain instead of dropping it.

Fixes #60341

Changelog:

[ANDROID] [FIXED] - Fix a blur of 0.5 or less in a filter list dropping every filter before it

Test Plan:

Traced parseFilters with [{grayscale: 1}, {blur: 0}]: before the change the chain ends up null after the blur step, now it stays as the grayscale effect. Matches the reproducer in the issue. No Android SDK on this machine, so I relied on CI for the build.

@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

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Visual regression

No visual differences at 8d32d6ae797d.

ios: no capture

@intergalacticspacehighway intergalacticspacehighway left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the fix looks correct. Can you also add a Robolectric test that checks parseFilters doesn't return null for that input?

@lazerg

lazerg commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

Added it in 8d32d6a, it checks that grayscale followed by a 0 blur still gives a non-null effect. I don't have an Android SDK set up here, so I'm counting on CI to run it.

@intergalacticspacehighway
intergalacticspacehighway merged commit 35f49a3 into react:main Nov 29, 2026
58 checks passed
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 blur of 0.5 or less in a filter list drops every filter before it, so [{grayscale: 1}, {blur: 0}] draws the view unfiltered

2 participants