Skip to content

Commit c760c94

Browse files
fix: silence warning in SurfaceIOS when using a transparent background with shadows
1 parent c2278b6 commit c760c94

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
@@ -141,8 +141,10 @@ const SurfaceIOS = forwardRef<
141141
...restStyle
142142
} = (StyleSheet.flatten(style) || {}) as ViewStyle;
143143

144-
const [filteredStyle, marginStyle] = splitStyles(restStyle, (style) =>
145-
style.startsWith('margin')
144+
const [filteredStyle, marginStyle, borderRadiusStyle] = splitStyles(
145+
restStyle,
146+
(style) => style.startsWith('margin'),
147+
(style) => style.startsWith('border') && style.endsWith('Radius')
146148
);
147149

148150
if (
@@ -155,9 +157,12 @@ const SurfaceIOS = forwardRef<
155157
);
156158
}
157159

160+
const bgColor = backgroundColorStyle || backgroundColor;
161+
158162
const outerLayerViewStyles = {
159163
...getStyleForShadowLayer(elevation, 0),
160164
...marginStyle,
165+
...borderRadiusStyle,
161166
position,
162167
alignSelf,
163168
top,
@@ -171,13 +176,15 @@ const SurfaceIOS = forwardRef<
171176
height,
172177
transform,
173178
opacity,
179+
backgroundColor: bgColor,
174180
};
175181

176182
const innerLayerViewStyles = {
177183
...getStyleForShadowLayer(elevation, 1),
184+
...borderRadiusStyle,
178185
...filteredStyle,
179186
flex: height ? 1 : undefined,
180-
backgroundColor: backgroundColorStyle || backgroundColor,
187+
backgroundColor: bgColor,
181188
};
182189

183190
return [outerLayerViewStyles, innerLayerViewStyles];

0 commit comments

Comments
 (0)