@@ -9,16 +9,23 @@ const offsetX = ["offsetX", "number"] as const;
99const offsetY = [ "offsetY" , "number" ] as const ;
1010const blurRadius = [ "blurRadius" , "number" ] as const ;
1111const spreadDistance = [ "spreadDistance" , "number" ] as const ;
12- // const inset = ["inset", "string"] as const;
12+ // Match the literal string "inset" - the array type checks if value is in array
13+ const inset = [ "inset" , [ "inset" ] ] as const ;
1314
1415const handler = shorthandHandler (
1516 [
17+ // Standard patterns (without inset)
1618 [ offsetX , offsetY , blurRadius , spreadDistance ] ,
1719 [ offsetX , offsetY , blurRadius , spreadDistance , color ] ,
1820 [ color , offsetX , offsetY ] ,
1921 [ color , offsetX , offsetY , blurRadius , spreadDistance ] ,
2022 [ offsetX , offsetY , color ] ,
2123 [ offsetX , offsetY , blurRadius , color ] ,
24+ // Inset patterns - "inset" keyword at the beginning
25+ [ inset , offsetX , offsetY , blurRadius , spreadDistance ] ,
26+ [ inset , offsetX , offsetY , blurRadius , spreadDistance , color ] ,
27+ [ inset , offsetX , offsetY , blurRadius , color ] ,
28+ [ inset , color , offsetX , offsetY , blurRadius , spreadDistance ] ,
2229 ] ,
2330 [ ] ,
2431 "object" ,
@@ -41,8 +48,10 @@ export const boxShadow: StyleFunctionResolver = (
4148 if ( shadows === undefined ) {
4249 return ;
4350 } else {
44- return omitTransparentShadows (
45- handler ( resolveValue , shadows , get , options ) ,
51+ return normalizeInsetValue (
52+ omitTransparentShadows (
53+ handler ( resolveValue , shadows , get , options ) ,
54+ ) ,
4655 ) ;
4756 }
4857 } )
@@ -69,3 +78,17 @@ function omitTransparentShadows(style: unknown) {
6978
7079 return style ;
7180}
81+
82+ /**
83+ * Convert inset: "inset" to inset: true for React Native boxShadow.
84+ *
85+ * The shorthand handler matches the literal "inset" string and assigns it as the value.
86+ * React Native's boxShadow expects inset to be a boolean.
87+ */
88+ function normalizeInsetValue ( style : unknown ) {
89+ if ( typeof style === "object" && style && "inset" in style ) {
90+ return { ...style , inset : true } ;
91+ }
92+
93+ return style ;
94+ }
0 commit comments