diff --git a/packages/core/ui/core/view/index.ios.ts b/packages/core/ui/core/view/index.ios.ts index 0df1791ec..c18d5189e 100644 --- a/packages/core/ui/core/view/index.ios.ts +++ b/packages/core/ui/core/view/index.ios.ts @@ -864,7 +864,13 @@ export class View extends ViewCommon implements ViewDefinition { return 0; } [zIndexProperty.setNative](value: number) { - this.nativeViewProtected.layer.zPosition = value; + const nativeView: NativeScriptUIView = this.nativeViewProtected; + + nativeView.layer.zPosition = value; + // Apply z-index to shadows as well + if (nativeView.outerShadowContainerLayer) { + nativeView.outerShadowContainerLayer.zPosition = value; + } } [backgroundInternalProperty.getDefault](): UIColor { diff --git a/packages/core/ui/styling/background.ios.ts b/packages/core/ui/styling/background.ios.ts index bcb14f8c3..f27ef5f73 100644 --- a/packages/core/ui/styling/background.ios.ts +++ b/packages/core/ui/styling/background.ios.ts @@ -143,7 +143,7 @@ export namespace ios { } if (!needsMask) { - clearLayerMask(nativeView, background); + clearLayerMask(nativeView); } // Clear box shadow if it's no longer needed @@ -345,7 +345,7 @@ function maskLayerIfNeeded(nativeView: NativeScriptUIView, background: Backgroun } } -function clearLayerMask(nativeView: NativeScriptUIView, background: BackgroundDefinition) { +function clearLayerMask(nativeView: NativeScriptUIView) { if (nativeView.outerShadowContainerLayer) { nativeView.outerShadowContainerLayer.mask = null; } @@ -1127,6 +1127,7 @@ function drawBoxShadow(view: View): void { outerShadowContainerLayer.bounds = bounds; outerShadowContainerLayer.anchorPoint = layer.anchorPoint; outerShadowContainerLayer.position = nativeView.center; + outerShadowContainerLayer.zPosition = layer.zPosition; // Inherit view visibility values outerShadowContainerLayer.opacity = layer.opacity;