Skip to content

Support drop-shadow filter utilities #643

Description

@feri-irawan

Tailwind CSS v4 provides drop-shadow-* utilities (drop-shadow-xs, drop-shadow-sm, drop-shadow-md, drop-shadow-lg, drop-shadow-xl, drop-shadow-2xl, drop-shadow-none, and arbitrary drop-shadow-[...]) that apply CSS filter: drop-shadow(...).

Currently in Uniwind, drop-shadow is explicitly ignored in packages/uniwind/src/bundler/css-processor/functions.ts by returning undefined.

Motivation

Uniwind already supports other CSS filter functions (blur, brightness, contrast, grayscale, hue-rotate, invert, opacity, saturate, sepia) as compiled filter strings.

With modern React Native (0.81+):

  • The filter style prop supports CSS filter strings including drop-shadow(offsetX offsetY blurRadius color) (available on Android API 31+ and iOS via SwiftUI-based filters).
  • Web runtime passes standard CSS filter strings directly.

Adding support for drop-shadow will complete the filter feature set and provide full parity with Tailwind CSS v4 filter utilities.

Proposed Solution

  1. Update CSS Processor (functions.ts):

    • Parse drop-shadow function arguments (x-offset, y-offset, blur-radius, and color) into a valid CSS filter string: drop-shadow(<offsetX> <offsetY> <blurRadius> <color>).
    • Support multi-drop-shadow values (e.g. drop-shadow-md which chains multiple drop-shadow(...) calls).
    • Support arbitrary drop-shadow values (e.g. drop-shadow-[0_10px_8px_rgba(0,0,0,0.5)]).
  2. Add Unit Tests (filters.test.tsx):

    • Add test cases in packages/uniwind/tests/native/styles-parsing/filters.test.tsx verifying:
      • Preset utilities: drop-shadow-sm, drop-shadow-md, drop-shadow-lg, drop-shadow-2xl, drop-shadow-none.
      • Arbitrary values: drop-shadow-[...].
      • Combination with other filters: e.g. blur-md drop-shadow-md.

Contribution

I am happy to submit a PR with this implementation and accompanying test cases.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions