diff --git a/packages/core/ui/core/view/index.ios.ts b/packages/core/ui/core/view/index.ios.ts index 679c21b666..0df1791ec9 100644 --- a/packages/core/ui/core/view/index.ios.ts +++ b/packages/core/ui/core/view/index.ios.ts @@ -155,21 +155,13 @@ export class View extends ViewCommon implements ViewDefinition { private layoutOuterShadows(): void { const nativeView: NativeScriptUIView = this.nativeViewProtected; - if (nativeView) { - const frame = nativeView.frame; - const needsUpdate: boolean = nativeView.outerShadowContainerLayer != null; + if (nativeView?.outerShadowContainerLayer) { + CATransaction.setDisableActions(true); - if (needsUpdate) { - CATransaction.setDisableActions(true); + nativeView.outerShadowContainerLayer.bounds = nativeView.bounds; + nativeView.outerShadowContainerLayer.position = nativeView.center; - if (nativeView.outerShadowContainerLayer) { - const { x: originX, y: originY }: CGPoint = nativeView.outerShadowContainerLayer.anchorPoint; - nativeView.outerShadowContainerLayer.bounds = nativeView.bounds; - nativeView.outerShadowContainerLayer.position = CGPointMake(frame.origin.x + frame.size.width * originX, frame.origin.y + frame.size.height * originY); - } - - CATransaction.setDisableActions(false); - } + CATransaction.setDisableActions(false); } } diff --git a/packages/core/ui/styling/background.ios.ts b/packages/core/ui/styling/background.ios.ts index 558abf7fa2..bcb14f8c3a 100644 --- a/packages/core/ui/styling/background.ios.ts +++ b/packages/core/ui/styling/background.ios.ts @@ -1091,7 +1091,6 @@ function drawBoxShadow(view: View): void { } const bounds = nativeView.bounds; - const viewFrame = nativeView.frame; const boxShadow: BoxShadow = background.getBoxShadow(); // Initialize outer shadows @@ -1127,10 +1126,7 @@ function drawBoxShadow(view: View): void { outerShadowContainerLayer.bounds = bounds; outerShadowContainerLayer.anchorPoint = layer.anchorPoint; - - // Since shadow uses superlayer's coordinate system, we have to be more specific about shadow layer position - const { x: originX, y: originY }: CGPoint = outerShadowContainerLayer.anchorPoint; - outerShadowContainerLayer.position = CGPointMake(viewFrame.origin.x + viewFrame.size.width * originX, viewFrame.origin.y + viewFrame.size.height * originY); + outerShadowContainerLayer.position = nativeView.center; // Inherit view visibility values outerShadowContainerLayer.opacity = layer.opacity;