Skip to content

Add support for box-shadow and filter properties#200

Open
wojtekmaj wants to merge 2 commits intostyled-components:masterfrom
wojtekmaj:box-shadow-and-filter
Open

Add support for box-shadow and filter properties#200
wojtekmaj wants to merge 2 commits intostyled-components:masterfrom
wojtekmaj:box-shadow-and-filter

Conversation

@wojtekmaj
Copy link
Contributor

@wojtekmaj wojtekmaj commented Mar 19, 2026

Closes #195

React Native supports box-shadow and filter properties natively since version 0.76. This means that every version of React Native that is stil supported can benefit from box-shadow and filter properties.

This may be considered a breaking change, since this drops support for React Native 0.75 and older - at the benefit of supporting newer versions, on which styling is currently broken.

How I tested it?

  • Added tests
  • Compiled the code myself and replaced dependency in a real project (see below)
const Box = styled.View`
  width: 50px;
  height: 50px;
  background-color: black;
  box-shadow: 5px 5px 5px red, -5px -5px 5px green;
  filter: opacity(0.5);
`;

<Box />

Before:

Zrzut ekranu 2026-03-20 o 00 19 17

After:

Zrzut ekranu 2026-03-20 o 00 19 55

Copilot AI review requested due to automatic review settings March 19, 2026 23:20
@wojtekmaj wojtekmaj force-pushed the box-shadow-and-filter branch from d6e7c31 to 38b59c4 Compare March 19, 2026 23:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CSS-to-React-Native transform behavior to align with newer React Native (>= 0.76) support for box-shadow and filter by passing them through as native style props instead of transforming box-shadow into legacy shadow* fields.

Changes:

  • Removes the boxShadow shorthand transform so box-shadow is treated as a raw, camelCased prop (boxShadow).
  • Adds/updates tests to assert pass-through behavior for filter and box-shadow, including multiple values.
  • Updates README guidance to reflect the new pass-through behavior and RN version dependency.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/transforms/index.js Stops registering the boxShadow transform so box-shadow is no longer expanded into shadow* props.
src/transforms/boxShadow.js Deletes the legacy box-shadow parsing/expansion implementation.
src/__tests__/units.js Updates the units test expectation for box-shadow to match pass-through behavior.
src/__tests__/index.js Adds test coverage for raw pass-through of filter and box-shadow (including multiple functions/values).
src/__tests__/boxShadow.js Removes tests that validated the old box-shadow -> shadow* expansion behavior.
README.md Updates documentation to describe pass-through behavior for box-shadow and filter.
.DS_Store Adds an unintended macOS metadata file to the repo.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jacobp100
Copy link
Contributor

I think this is fine to get in, but would be a breaking change. If you bump the version number, we can merge. Then we'd need a separate PR in styled-components to bump the dependency version

@wojtekmaj wojtekmaj force-pushed the box-shadow-and-filter branch from c5793be to c26ea69 Compare March 20, 2026 09:33
@wojtekmaj
Copy link
Contributor Author

@jacobp100 Done! I wasn't sure how you wanted to manage this, hence I left that part out before.

@jacobp100
Copy link
Contributor

One conflict

@mxstbr Are you still doing releases - or know who would do a release?

React Native supports box-shadow and filter properties natively since version 0.76. This means that every version of React Native that is stil supported can benefit from box-shadow and filter properties.
@wojtekmaj wojtekmaj force-pushed the box-shadow-and-filter branch from c26ea69 to 0c0a79a Compare March 20, 2026 09:41
@wojtekmaj
Copy link
Contributor Author

Zero conflicts 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for React Native 0.76 boxShadow and filter

3 participants