Repository navigation
Conversation
A `boxShadow` drew over the view's children when the view had no border layer. Each shadow layer copied `_borderLayer.zPosition`, and a view whose border Core Animation draws (no border, or a uniform border on a clipping view) has no border layer, so the shadow got z-position 0. Children also have z-position 0 and the shadow layers are added after them, so the shadow painted on top: an inset shadow over every child, and an outset shadow over a child that overflows the view. CSS paints box shadows above the element's background and below its border and content (https://drafts.csswg.org/css-backgrounds-3/#box-shadow). Give the shadow layers a fixed z-position between the background layers and the border layer. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
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.
Summary:
A
boxShadowdraws over the view's children on iOS when the view has no border layer.RCTViewComponentViewgives each shadow layer_borderLayer.zPosition. A view whose border Core Animation draws (no border, or a uniform border on a clipping view) has no border layer, so the shadow gets z-position 0. Children also have z-position 0, and the shadow layers are added after them, so the shadow paints on top. An inset ring that an opaque child should cover shows over the child instead, and an outset shadow covers the part of a child that overflows the view.CSS paints box shadows above the element's background and below its border and content (css-backgrounds-3, "box-shadow"). This change gives the shadow layers a fixed z-position between the background layers (
BACKGROUND_COLOR_ZPOSITION) and the border layer (BACKGROUND_COLOR_ZPOSITION + 1).Two things change for a view without a border layer: an inset shadow is drawn below every child, and an outset shadow is drawn below a child that overflows the view, where it used to cover the overflowing part. Views that have a border layer already drew their shadows below the children. Their shadows now also sit below the border layer instead of level with it, which changes nothing visible: an outset shadow is masked to the outside of the border box and an inset one to the inside of the padding box.
Changelog:
[IOS] [FIXED] - Draw
boxShadowbelow the view's children when the view has no separate border layer: an inset shadow no longer covers them, and an outset shadow no longer covers a child that overflows the viewTest Plan:
Ran:
Run on this base (2026-11-28, Xcode 27.1, iOS 27.0 simulator):
RCTViewComponentViewTestson this branch: 26 tests, 0 failures.RCTViewComponentView.mmfrommainand the test kept:testInsetBoxShadowIsBelowChildrenWithoutBorderLayerfails (0is not less than0).React/Testsbelongs to theReact-RCTFabricpod'sTeststest spec, which RNTester's Podfile does not install. To run it, I added:testspecs => ['Tests']to theReact-RCTFabricpod inscripts/cocoapods/fabric.rb, narrowed the test spec'ssource_filesto this test file, and added an empty Swift file to the test spec so the bundle links the Swift runtime thatRCTSwiftUIneeds. None of that is part of this change. With the whole test spec,RCTSelectableParagraphComponentViewTests.mmdoes not compile in open source (react/renderer/element/ComponentBuilder.hnot found).Visual check still needed, in RNTester on a simulator before and after: a view with
boxShadow: 'inset 0 0 0 8px black', no border, and an opaque child that fills it. Before, a black ring shows over the child; after, the child covers it. The same for an outset shadow (boxShadow: '0 0 0 8px black') with an opaque child that extends past the view's edge: before, the shadow shows over the overflowing part of the child; after, the child covers it.🤖 Generated with Claude Code