Files
react-native/packages
Joe VilchesandFacebook GitHub Bot 0f87250d29 Adjust shadow's corner radius based on spread (#45336)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45336

The spec says we need to adjust the border radius of the shadow if spread is present. It gets bigger for outset shadows and smaller for inset shadows.

Source https://drafts.csswg.org/css-backgrounds/#shadow-shape

> To preserve the box’s shape when spread is applied, the corner radii of the shadow are also increased (decreased, for inner shadows) from the border-box (padding-box) radii by adding (subtracting) the spread distance (and flooring at zero). However, in order to create a sharper corner when the border radius is small (and thus ensure continuity between round and sharp corners), when the border radius is less than the spread distance (or in the case of an inner shadow, less than the absolute value of a negative spread distance), the spread distance is first multiplied by the proportion 1 + (r-1)3, where r is the ratio of the border radius to the spread distance, in calculating the corner radii of the spread shadow shape.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D59296120

fbshipit-source-id: e55327701547f27961a0d612ed595b4383e1d763
2024-07-09 13:24:18 -07:00
..