fix(ios): shadow does not consider z-index (#10433)

This commit is contained in:
Dimitris-Rafail Katsampas
2023-11-24 20:04:06 +02:00
committed by GitHub
parent 9fae9c4281
commit 5a4bb7c38c
2 changed files with 10 additions and 3 deletions

View File

@ -864,7 +864,13 @@ export class View extends ViewCommon implements ViewDefinition {
return 0; return 0;
} }
[zIndexProperty.setNative](value: number) { [zIndexProperty.setNative](value: number) {
this.nativeViewProtected.layer.zPosition = value; const nativeView: NativeScriptUIView = <NativeScriptUIView>this.nativeViewProtected;
nativeView.layer.zPosition = value;
// Apply z-index to shadows as well
if (nativeView.outerShadowContainerLayer) {
nativeView.outerShadowContainerLayer.zPosition = value;
}
} }
[backgroundInternalProperty.getDefault](): UIColor { [backgroundInternalProperty.getDefault](): UIColor {

View File

@ -143,7 +143,7 @@ export namespace ios {
} }
if (!needsMask) { if (!needsMask) {
clearLayerMask(nativeView, background); clearLayerMask(nativeView);
} }
// Clear box shadow if it's no longer needed // 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) { if (nativeView.outerShadowContainerLayer) {
nativeView.outerShadowContainerLayer.mask = null; nativeView.outerShadowContainerLayer.mask = null;
} }
@ -1127,6 +1127,7 @@ function drawBoxShadow(view: View): void {
outerShadowContainerLayer.bounds = bounds; outerShadowContainerLayer.bounds = bounds;
outerShadowContainerLayer.anchorPoint = layer.anchorPoint; outerShadowContainerLayer.anchorPoint = layer.anchorPoint;
outerShadowContainerLayer.position = nativeView.center; outerShadowContainerLayer.position = nativeView.center;
outerShadowContainerLayer.zPosition = layer.zPosition;
// Inherit view visibility values // Inherit view visibility values
outerShadowContainerLayer.opacity = layer.opacity; outerShadowContainerLayer.opacity = layer.opacity;