@@ -712,7 +712,6 @@ function drawNoRadiusNonUniformBorders(nativeView: NativeScriptUIView, backgroun
712712// TODO: use sublayer if its applied to a layout
713713function drawBoxShadow ( nativeView : NativeScriptUIView , view : View , boxShadow : CSSShadow , background : BackgroundDefinition , useSubLayer : boolean = false ) {
714714 const layer : CALayer = iOSNativeHelper . getShadowLayer ( nativeView , 'ns-box-shadow' ) ;
715- const renderSize = view . getActualSize ( ) || { width : 0 , height : 0 } ;
716715
717716 layer . masksToBounds = false ;
718717 nativeView . clipsToBounds = false ;
@@ -721,23 +720,10 @@ function drawBoxShadow(nativeView: NativeScriptUIView, view: View, boxShadow: CS
721720 // nativeView.clipsToBounds doesn't work
722721 view . setProperty ( 'clipToBounds' , false ) ;
723722
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-
736723 if ( ! background . color ?. a ) {
737724 // add white background if view has a transparent background
738725 layer . backgroundColor = UIColor . whiteColor . CGColor ;
739726 }
740-
741727 // shadow opacity is handled on the shadow's color instance
742728 layer . shadowOpacity = boxShadow . color ?. a ? boxShadow . color ?. a / 255 : 1 ;
743729 layer . shadowRadius = Length . toDevicePixels ( boxShadow . blurRadius , 0.0 ) ;
@@ -749,6 +735,9 @@ function drawBoxShadow(nativeView: NativeScriptUIView, view: View, boxShadow: CS
749735 Length . toDevicePixels ( boxShadow . offsetY , 0.0 )
750736 ) ;
751737
738+ // this should match the view's border radius
739+ const cornerRadius = Length . toDevicePixels ( < CoreTypes . LengthType > view . style . borderRadius , 0.0 ) ;
740+
752741 // apply spreadRadius by expanding shadow layer bounds
753742 // prettier-ignore
754743 const bounds = CGRectInset ( nativeView . bounds ,
@@ -762,18 +751,10 @@ function drawBoxShadow(nativeView: NativeScriptUIView, view: View, boxShadow: CS
762751
763752function clearBoxShadow ( nativeView : NativeScriptUIView ) {
764753 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-
772754 const layer : CALayer = iOSNativeHelper . getShadowLayer ( nativeView , 'ns-box-shadow' , false ) ;
773755 if ( ! layer ) {
774756 return ;
775757 }
776-
777758 layer . masksToBounds = true ;
778759 layer . shadowOffset = CGSizeMake ( 0 , 0 ) ;
779760 layer . shadowColor = UIColor . clearColor . CGColor ;
0 commit comments