@@ -238,21 +238,26 @@ const Surface = forwardRef<View, Props>(
238
238
...restStyle
239
239
} = ( StyleSheet . flatten ( style ) || { } ) as ViewStyle ;
240
240
241
- const [ filteredStyle , borderRadiusStyle , marginStyle ] = splitStyles (
242
- restStyle ,
243
- ( style ) => style . startsWith ( 'border' ) && style . endsWith ( 'Radius' ) ,
244
- ( style ) => style . startsWith ( 'margin' )
241
+ const [ filteredStyle , marginStyle ] = splitStyles ( restStyle , ( style ) =>
242
+ style . startsWith ( 'margin' )
245
243
) ;
246
244
247
- const sharedStyles = {
248
- flex : height ? 1 : undefined ,
249
- } ;
245
+ if (
246
+ process . env . NODE_ENV !== 'production' &&
247
+ filteredStyle . overflow === 'hidden' &&
248
+ elevation !== 0
249
+ ) {
250
+ console . warn (
251
+ 'When setting overflow to hidden on Surface the shadow will not be displayed correctly. Wrap the content of your component in a separate View with the overflow style.'
252
+ ) ;
253
+ }
250
254
251
255
const innerLayerViewStyles = [
252
256
filteredStyle ,
253
- sharedStyles ,
254
- borderRadiusStyle ,
255
- { backgroundColor : backgroundColorStyle || backgroundColor } ,
257
+ {
258
+ flex : height ? 1 : undefined ,
259
+ backgroundColor : backgroundColorStyle || backgroundColor ,
260
+ } ,
256
261
] ;
257
262
258
263
const outerLayerViewStyles = {
@@ -303,16 +308,10 @@ const Surface = forwardRef<View, Props>(
303
308
testID = { `${ testID } -outer-layer` }
304
309
>
305
310
< Animated . View
306
- style = { [ getStyleForAnimatedShadowLayer ( 1 ) , sharedStyles ] }
307
- testID = { ` ${ testID } -middle-layer` }
311
+ style = { [ getStyleForAnimatedShadowLayer ( 1 ) , innerLayerViewStyles ] }
312
+ testID = { testID }
308
313
>
309
- < Animated . View
310
- { ...props }
311
- testID = { testID }
312
- style = { innerLayerViewStyles }
313
- >
314
- { children }
315
- </ Animated . View >
314
+ { children }
316
315
</ Animated . View >
317
316
</ Animated . View >
318
317
) ;
@@ -339,16 +338,11 @@ const Surface = forwardRef<View, Props>(
339
338
testID = { `${ testID } -outer-layer` }
340
339
>
341
340
< Animated . View
342
- style = { [ getStyleForShadowLayer ( 1 ) , sharedStyles ] }
343
- testID = { `${ testID } -middle-layer` }
341
+ { ...props }
342
+ style = { [ getStyleForShadowLayer ( 1 ) , innerLayerViewStyles ] }
343
+ testID = { testID }
344
344
>
345
- < Animated . View
346
- { ...props }
347
- testID = { testID }
348
- style = { innerLayerViewStyles }
349
- >
350
- { children }
351
- </ Animated . View >
345
+ { children }
352
346
</ Animated . View >
353
347
</ Animated . View >
354
348
) ;
0 commit comments