Skip to content

feat: add iOS support for CSS mask properties - #58164

Open
paradowstack wants to merge 5 commits into
react:mainfrom
paradowstack:feat/mask-ios
Open

feat: add iOS support for CSS mask properties#58164
paradowstack wants to merge 5 commits into
react:mainfrom
paradowstack:feat/mask-ios

Conversation

@paradowstack

@paradowstack paradowstack commented Aug 27, 2026

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). 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 layers are drawn with the same gradient and image helpers as background-image, assembled into a CALayer tree and assigned as the mask of the container layer, so masking is intersected with the border radius clipping shape and applies to children as well. url() masks reuse the background-image URL 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. this PR - iOS rendering and the RNTester example page
  3. Android - Android rendering

The stack is based on the url() in background-image work, which has to land first.

Changelog:

[IOS] [ADDED] - Add iOS support for CSS mask properties

Test Plan:

Run RNTester on iOS 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
@paradowstack paradowstack changed the title Feat/mask ios feat: add iOS support for CSS mask properties 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