mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 10:01:08 +08:00
fix(ios): shadow does not consider z-index (#10433)
This commit is contained in:

committed by
GitHub

parent
9fae9c4281
commit
5a4bb7c38c
@ -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 = <NativeScriptUIView>this.nativeViewProtected;
|
||||
|
||||
nativeView.layer.zPosition = value;
|
||||
// Apply z-index to shadows as well
|
||||
if (nativeView.outerShadowContainerLayer) {
|
||||
nativeView.outerShadowContainerLayer.zPosition = value;
|
||||
}
|
||||
}
|
||||
|
||||
[backgroundInternalProperty.getDefault](): UIColor {
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user