feat: add Android support for CSS mask properties - #58165
Open
paradowstack wants to merge 6 commits into
Open
Conversation
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
lint fix add local image example
copy bitmap on background thread
paradowstack
marked this pull request as ready for review
August 27, 2026 12:13
paradowstack
force-pushed
the
feat/mask-android
branch
from
August 27, 2026 12:22
6c45600 to
f86060a
Compare
paradowstack
force-pushed
the
feat/mask-android
branch
from
August 27, 2026 12:38
f86060a to
8cb9be0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebase Note:
This branch is stacked on #54995 + #54996 + #54994 (Nishan's
url()inbackground-imagework) and #58163 (JS & C++ changes) and #58164 (iOS changes). Once this work lands, this branch has to be rebased. Review only the last commit.Summary:
This PR adds support for the
mask-image,mask-size,mask-positionandmask-repeatCSS properties. It follows the CSS spec described here. A mask clips a view and its whole subtree to the alpha channel of a gradient or an image. The remaining mask properties (mask-clip,mask-origin,mask-mode,mask-composite) and themaskshorthand are not covered here and can be added in a follow up PR if needed.The mask is a second
BackgroundImageDrawableheld byCompositeBackgroundDrawable, composited over the view's own rendering withPorterDuff.Mode.DST_INso that children are masked too. Views that draw outside of the composite background (text, images, text inputs, scroll views) wrap theironDrawin the same masked layer.url()masks reuse thebackground-imageimage loader, so no new image loading code is introduced.Work has been split into three stacked PRs for more convenient reviewing process:
Changelog:
[ANDROID] [ADDED] - Add Android support for CSS mask properties
Test Plan:
Run RNTester on Android and open the Mask screen (
MaskExample.js) - gradient, local and remote image masks,mask-repeat,mask-size,mask-position, multiple layers, border radius, masked children, text, image, scroll view and text input.