Skip to content

Commit da06a67

Browse files
committed
fix(modal): properly hadnling presenting element when starting in portrait and going to landscape
1 parent 50f8f64 commit da06a67

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

core/src/components/modal/animations/ios.transition.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ export const portraitToLandscapeTransition = (
3232
.easing('cubic-bezier(0.32,0.72,0,1)')
3333
.duration(duration);
3434

35-
const presentingAnimation = createAnimation();
35+
const presentingAnimation = createAnimation().beforeStyles({
36+
transform: 'translateY(0)',
37+
'transform-origin': 'top center',
38+
overflow: 'hidden',
39+
});
3640

3741
if (!hasCardModal) {
3842
// Non-card modal: transition from portrait state to landscape state
@@ -55,6 +59,10 @@ export const portraitToLandscapeTransition = (
5559

5660
presentingAnimation
5761
.addElement(presentingEl)
62+
.afterStyles({
63+
transform: 'translateY(0px) scale(1)',
64+
'border-radius': '0px',
65+
})
5866
.beforeAddWrite(() => bodyEl.style.setProperty('background-color', ''))
5967
.fromTo('transform', fromTransform, 'translateY(0px) scale(1)')
6068
.fromTo('filter', 'contrast(0.85)', 'contrast(1)')
@@ -111,7 +119,11 @@ export const landscapeToPortraitTransition = (
111119
.easing('cubic-bezier(0.32,0.72,0,1)')
112120
.duration(duration);
113121

114-
const presentingAnimation = createAnimation();
122+
const presentingAnimation = createAnimation().beforeStyles({
123+
transform: 'translateY(0)',
124+
'transform-origin': 'top center',
125+
overflow: 'hidden',
126+
});
115127

116128
if (!hasCardModal) {
117129
// Non-card modal: transition from landscape state to portrait state
@@ -131,6 +143,10 @@ export const landscapeToPortraitTransition = (
131143

132144
presentingAnimation
133145
.addElement(presentingEl)
146+
.afterStyles({
147+
transform: toTransform,
148+
'border-radius': '10px 10px 0 0',
149+
})
134150
.beforeAddWrite(() => bodyEl.style.setProperty('background-color', 'black'))
135151
.fromTo('transform', 'translateY(0px) scale(1)', toTransform)
136152
.fromTo('filter', 'contrast(1)', 'contrast(0.85)')

0 commit comments

Comments
 (0)