Skip to content

Commit c78ea79

Browse files
authored
fix(ios): shadow position after translate transform (#10413)
1 parent ee87b52 commit c78ea79

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

Diff for: packages/core/ui/core/view/index.ios.ts

+5-13
Original file line numberDiff line numberDiff line change
@@ -155,21 +155,13 @@ export class View extends ViewCommon implements ViewDefinition {
155155

156156
private layoutOuterShadows(): void {
157157
const nativeView: NativeScriptUIView = <NativeScriptUIView>this.nativeViewProtected;
158-
if (nativeView) {
159-
const frame = nativeView.frame;
160-
const needsUpdate: boolean = nativeView.outerShadowContainerLayer != null;
158+
if (nativeView?.outerShadowContainerLayer) {
159+
CATransaction.setDisableActions(true);
161160

162-
if (needsUpdate) {
163-
CATransaction.setDisableActions(true);
161+
nativeView.outerShadowContainerLayer.bounds = nativeView.bounds;
162+
nativeView.outerShadowContainerLayer.position = nativeView.center;
164163

165-
if (nativeView.outerShadowContainerLayer) {
166-
const { x: originX, y: originY }: CGPoint = nativeView.outerShadowContainerLayer.anchorPoint;
167-
nativeView.outerShadowContainerLayer.bounds = nativeView.bounds;
168-
nativeView.outerShadowContainerLayer.position = CGPointMake(frame.origin.x + frame.size.width * originX, frame.origin.y + frame.size.height * originY);
169-
}
170-
171-
CATransaction.setDisableActions(false);
172-
}
164+
CATransaction.setDisableActions(false);
173165
}
174166
}
175167

Diff for: packages/core/ui/styling/background.ios.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,6 @@ function drawBoxShadow(view: View): void {
10911091
}
10921092

10931093
const bounds = nativeView.bounds;
1094-
const viewFrame = nativeView.frame;
10951094
const boxShadow: BoxShadow = background.getBoxShadow();
10961095

10971096
// Initialize outer shadows
@@ -1127,10 +1126,7 @@ function drawBoxShadow(view: View): void {
11271126

11281127
outerShadowContainerLayer.bounds = bounds;
11291128
outerShadowContainerLayer.anchorPoint = layer.anchorPoint;
1130-
1131-
// Since shadow uses superlayer's coordinate system, we have to be more specific about shadow layer position
1132-
const { x: originX, y: originY }: CGPoint = outerShadowContainerLayer.anchorPoint;
1133-
outerShadowContainerLayer.position = CGPointMake(viewFrame.origin.x + viewFrame.size.width * originX, viewFrame.origin.y + viewFrame.size.height * originY);
1129+
outerShadowContainerLayer.position = nativeView.center;
11341130

11351131
// Inherit view visibility values
11361132
outerShadowContainerLayer.opacity = layer.opacity;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy