feat: add Tailwind CSS v4 shadow support and inset shadows #277
+163
−3
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
This PR adds two features for better Tailwind CSS v4 compatibility in React Native:
Problem
Tailwind CSS v4 Shadow Variables
Tailwind CSS v4 uses
@propertyto define initial-value for shadow CSS variables:Since react-native-css doesn't support
@propertydeclarations, these variables are undefined when shadow utilities are used, causing runtime errors.Inset Shadows Not Supported
CSS
insetshadows likebox-shadow: inset 0 0 24px 0 #fffwere not being parsed because there was no pattern matching for theinsetkeyword.Solution
1. Root Variable Defaults
Added default values for Tailwind v4 shadow variables in
src/native-internal/root.ts:--tw-shadow--tw-shadow-color--tw-inset-shadow--tw-inset-shadow-color--tw-ring-shadow--tw-inset-ring-shadow--tw-ring-offset-shadowThese are set to transparent shadow values that get filtered out by
omitTransparentShadows.2. Inset Shadow Parsing
Added pattern matching for inset shadows in
src/native/styles/shorthands/box-shadow.ts:The
normalizeInsetValuefunction convertsinset: "inset"toinset: trueas expected by React Native'sboxShadowprop.Testing
Added 5 new tests covering:
All existing tests continue to pass.
Related