@@ -712,7 +712,6 @@ function drawNoRadiusNonUniformBorders(nativeView: NativeScriptUIView, backgroun
712
712
// TODO: use sublayer if its applied to a layout
713
713
function drawBoxShadow ( nativeView : NativeScriptUIView , view : View , boxShadow : CSSShadow , background : BackgroundDefinition , useSubLayer : boolean = false ) {
714
714
const layer : CALayer = iOSNativeHelper . getShadowLayer ( nativeView , 'ns-box-shadow' ) ;
715
- const renderSize = view . getActualSize ( ) || { width : 0 , height : 0 } ;
716
715
717
716
layer . masksToBounds = false ;
718
717
nativeView . clipsToBounds = false ;
@@ -721,23 +720,10 @@ function drawBoxShadow(nativeView: NativeScriptUIView, view: View, boxShadow: CS
721
720
// nativeView.clipsToBounds doesn't work
722
721
view . setProperty ( 'clipToBounds' , false ) ;
723
722
724
- // This should match the view's border radius (only uniform radius is supported for now)
725
- let cornerRadius = layout . toDeviceIndependentPixels ( background . borderTopLeftRadius ) ;
726
- cornerRadius = Math . min ( Math . min ( renderSize . width / 2 , renderSize . height / 2 ) , cornerRadius ) ;
727
-
728
- // Apply corner radius to sub layers as clipToBounds and masksToBounds are now set to false
729
- const sublayers = nativeView . layer ?. sublayers ;
730
- if ( sublayers ) {
731
- for ( let i = 0 ; i < sublayers . count ; i ++ ) {
732
- sublayers . objectAtIndex ( i ) . cornerRadius = cornerRadius ;
733
- }
734
- }
735
-
736
723
if ( ! background . color ?. a ) {
737
724
// add white background if view has a transparent background
738
725
layer . backgroundColor = UIColor . whiteColor . CGColor ;
739
726
}
740
-
741
727
// shadow opacity is handled on the shadow's color instance
742
728
layer . shadowOpacity = boxShadow . color ?. a ? boxShadow . color ?. a / 255 : 1 ;
743
729
layer . shadowRadius = Length . toDevicePixels ( boxShadow . blurRadius , 0.0 ) ;
@@ -749,6 +735,9 @@ function drawBoxShadow(nativeView: NativeScriptUIView, view: View, boxShadow: CS
749
735
Length . toDevicePixels ( boxShadow . offsetY , 0.0 )
750
736
) ;
751
737
738
+ // this should match the view's border radius
739
+ const cornerRadius = Length . toDevicePixels ( < CoreTypes . LengthType > view . style . borderRadius , 0.0 ) ;
740
+
752
741
// apply spreadRadius by expanding shadow layer bounds
753
742
// prettier-ignore
754
743
const bounds = CGRectInset ( nativeView . bounds ,
@@ -762,18 +751,10 @@ function drawBoxShadow(nativeView: NativeScriptUIView, view: View, boxShadow: CS
762
751
763
752
function clearBoxShadow ( nativeView : NativeScriptUIView ) {
764
753
nativeView . clipsToBounds = true ;
765
- const sublayers = nativeView . layer ?. sublayers ;
766
- if ( sublayers ) {
767
- for ( let i = 0 ; i < sublayers . count ; i ++ ) {
768
- sublayers . objectAtIndex ( i ) . cornerRadius = 0.0 ;
769
- }
770
- }
771
-
772
754
const layer : CALayer = iOSNativeHelper . getShadowLayer ( nativeView , 'ns-box-shadow' , false ) ;
773
755
if ( ! layer ) {
774
756
return ;
775
757
}
776
-
777
758
layer . masksToBounds = true ;
778
759
layer . shadowOffset = CGSizeMake ( 0 , 0 ) ;
779
760
layer . shadowColor = UIColor . clearColor . CGColor ;
0 commit comments