Skip to content

feat: add Android support for CSS mask properties - #58165

Open
paradowstack wants to merge 6 commits into
react:mainfrom
paradowstack:feat/mask-android
Open

feat: add Android support for CSS mask properties#58165
paradowstack wants to merge 6 commits into
react:mainfrom
paradowstack:feat/mask-android

Conversation

@paradowstack

Copy link
Copy Markdown
Contributor

Rebase Note:

This branch is stacked on #54995 + #54996 + #54994 (Nishan's url() in background-image work) 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-position and mask-repeat CSS 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 the mask shorthand are not covered here and can be added in a follow up PR if needed.

The mask is a second BackgroundImageDrawable held by CompositeBackgroundDrawable, composited over the view's own rendering with PorterDuff.Mode.DST_IN so that children are masked too. Views that draw outside of the composite background (text, images, text inputs, scroll views) wrap their onDraw in the same masked layer. url() masks reuse the background-image image loader, so no new image loading code is introduced.

Work has been split into three stacked PRs for more convenient reviewing process:

  1. JS - style attributes, Flow types and the cross platform prop plumbing in C++
  2. iOS - iOS rendering and the RNTester example page
  3. this PR - Android rendering

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.

image

@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 Aug 27, 2026
@github-actions

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

@paradowstack
paradowstack marked this pull request as ready for review August 27, 2026 12:13
@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 Aug 27, 2026
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. p: Callstack Partner: Callstack Partner 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.

2 participants