Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce "BoxShadowDrawable" for Android box shadows #43722

Closed
wants to merge 4 commits into from

Conversation

NickGerleman
Copy link
Contributor

@NickGerleman NickGerleman commented Mar 31, 2024

Summary

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android RenderNode and RenderEffect APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Test Plan

Below applies a 5px black spread with a 10px blur to the purple view which includes a border radius. Other combinations of offsets, spreads, and blur radii were tested.

When I did this inside of the existing filters test (top has filter applied), it highlighted an issue of clipping content outside of filtered area, which will not be related directly to this change.

Changelog: [Internal]

Differential Revision: D55561465

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Mar 31, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55561465

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55561465

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 1, 2024
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D55561465
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55561465

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 2, 2024
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D55561465
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55561465

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 2, 2024
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D55561465
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55561465

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 2, 2024
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Differential Revision: D55561465
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55561465

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 2, 2024
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Differential Revision: D55561465
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55561465

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 2, 2024
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Differential Revision: D55561465
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55561465

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 2, 2024
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Differential Revision: D55561465
@analysis-bot
Copy link

analysis-bot commented Apr 2, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 19,385,272 +11
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,760,270 +6
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 1b152f6
Branch: main

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55561465

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 8, 2024
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Reviewed By: javache, cortinico

Differential Revision: D55561465
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55561465

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 9, 2024
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Reviewed By: javache, cortinico

Differential Revision: D55561465
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 9, 2024
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Differential Revision: D55561465

Reviewed By: joevilches
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 9, 2024
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Differential Revision: D55561465

Reviewed By: joevilches
NickGerleman and others added 4 commits April 12, 2024 23:25
Differential Revision: D55635743
Summary:
Pull Request resolved: facebook#43722

This change adds a drawable, when when drawn on the bounds of a border-box sized view, will draw a spec compliant box-shadow outside the box. This is reliant on Android `RenderNode` and `RenderEffect` APIs provided by API 31.

Inset box shadows can also be added using a similar method, but this is not done yet.

The code which manages this is in flux, but the underlying drawable should be good. Will add some tests once it's more wired up.

Changelog: [Internal]

Reviewed By: javache, cortinico

Differential Revision: D55561465
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55561465

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 314a919.

@mrousavy
Copy link
Contributor

mrousavy commented Jun 8, 2024

this is amazing! nice work nick!

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. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants