Skip to content

Commit 5a4bb7c

Browse files
authored
fix(ios): shadow does not consider z-index (#10433)
1 parent 9fae9c4 commit 5a4bb7c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

packages/core/ui/core/view/index.ios.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,13 @@ export class View extends ViewCommon implements ViewDefinition {
864864
return 0;
865865
}
866866
[zIndexProperty.setNative](value: number) {
867-
this.nativeViewProtected.layer.zPosition = value;
867+
const nativeView: NativeScriptUIView = <NativeScriptUIView>this.nativeViewProtected;
868+
869+
nativeView.layer.zPosition = value;
870+
// Apply z-index to shadows as well
871+
if (nativeView.outerShadowContainerLayer) {
872+
nativeView.outerShadowContainerLayer.zPosition = value;
873+
}
868874
}
869875

870876
[backgroundInternalProperty.getDefault](): UIColor {

packages/core/ui/styling/background.ios.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export namespace ios {
143143
}
144144

145145
if (!needsMask) {
146-
clearLayerMask(nativeView, background);
146+
clearLayerMask(nativeView);
147147
}
148148

149149
// Clear box shadow if it's no longer needed
@@ -345,7 +345,7 @@ function maskLayerIfNeeded(nativeView: NativeScriptUIView, background: Backgroun
345345
}
346346
}
347347

348-
function clearLayerMask(nativeView: NativeScriptUIView, background: BackgroundDefinition) {
348+
function clearLayerMask(nativeView: NativeScriptUIView) {
349349
if (nativeView.outerShadowContainerLayer) {
350350
nativeView.outerShadowContainerLayer.mask = null;
351351
}
@@ -1127,6 +1127,7 @@ function drawBoxShadow(view: View): void {
11271127
outerShadowContainerLayer.bounds = bounds;
11281128
outerShadowContainerLayer.anchorPoint = layer.anchorPoint;
11291129
outerShadowContainerLayer.position = nativeView.center;
1130+
outerShadowContainerLayer.zPosition = layer.zPosition;
11301131

11311132
// Inherit view visibility values
11321133
outerShadowContainerLayer.opacity = layer.opacity;

0 commit comments

Comments
 (0)