Skip to content

Commit 2547613

Browse files
fix: silence warning in SurfaceIOS when using a transparent background with shadows
1 parent 65e99b2 commit 2547613

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/components/Surface.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ const SurfaceIOS = forwardRef<
145145
...restStyle
146146
} = (StyleSheet.flatten(style) || {}) as ViewStyle;
147147

148-
const [filteredStyles, marginStyles] = splitStyles(restStyle, (style) =>
149-
style.startsWith('margin')
148+
const [filteredStyles, marginStyles, borderRadiusStyles] = splitStyles(
149+
restStyle,
150+
(style) => style.startsWith('margin'),
151+
(style) => style.startsWith('border') && style.endsWith('Radius')
150152
);
151153

152154
if (
@@ -159,9 +161,12 @@ const SurfaceIOS = forwardRef<
159161
);
160162
}
161163

164+
const bgColor = backgroundColorStyle || backgroundColor;
165+
162166
const outerLayerViewStyles = {
163167
...getStyleForShadowLayer(elevation, 0),
164168
...marginStyles,
169+
...borderRadiusStyles,
165170
position,
166171
alignSelf,
167172
top,
@@ -175,13 +180,15 @@ const SurfaceIOS = forwardRef<
175180
height,
176181
transform,
177182
opacity,
183+
backgroundColor: bgColor,
178184
};
179185

180186
const innerLayerViewStyles = {
181187
...getStyleForShadowLayer(elevation, 1),
182188
...filteredStyles,
189+
...borderRadiusStyles,
183190
flex: height ? 1 : undefined,
184-
backgroundColor: backgroundColorStyle || backgroundColor,
191+
backgroundColor: bgColor,
185192
};
186193

187194
return [outerLayerViewStyles, innerLayerViewStyles];

0 commit comments

Comments
 (0)