Skip to content

Commit 804d043

Browse files
committed
fix(modal): add animation when scrollAtEdge is false
1 parent 44b8152 commit 804d043

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

core/src/components/modal/animations/sheet.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { ModalAnimationOptions } from '../modal-interface';
44
import { getBackdropValueForSheet } from '../utils';
55

66
export const createSheetEnterAnimation = (opts: ModalAnimationOptions) => {
7-
const { currentBreakpoint, backdropBreakpoint } = opts;
7+
const { currentBreakpoint, backdropBreakpoint, scrollAtEdge } = opts;
88

99
/**
1010
* If the backdropBreakpoint is undefined, then the backdrop
@@ -32,10 +32,12 @@ export const createSheetEnterAnimation = (opts: ModalAnimationOptions) => {
3232
/**
3333
* This allows the content to be scrollable at any breakpoint.
3434
*/
35-
const contentAnimation = createAnimation('contentAnimation').keyframes([
36-
{ offset: 0, opacity: 1, maxHeight: `${(1 - currentBreakpoint!) * 100}%` },
37-
{ offset: 1, opacity: 1, maxHeight: `${currentBreakpoint! * 100}%` },
38-
]);
35+
const contentAnimation = !scrollAtEdge
36+
? createAnimation('contentAnimation').keyframes([
37+
{ offset: 0, opacity: 1, maxHeight: `${(1 - currentBreakpoint!) * 100}%` },
38+
{ offset: 1, opacity: 1, maxHeight: `${currentBreakpoint! * 100}%` },
39+
])
40+
: undefined;
3941

4042
return { wrapperAnimation, backdropAnimation, contentAnimation };
4143
};

core/src/components/modal/modal.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ ion-backdrop {
167167
bottom: 0;
168168
}
169169

170-
// :host(.modal-sheet.modal-scroll-all) ion-footer {
171-
// position: absolute;
172-
// bottom: 0;
170+
:host(.modal-sheet.modal-scroll-all) ion-footer {
171+
position: absolute;
172+
bottom: 0;
173173

174-
// width: var(--width);
175-
// }
174+
width: var(--width);
175+
}

core/src/components/modal/modal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,6 @@ export class Modal implements ComponentInterface, OverlayInterface {
951951
focusTrap,
952952
scrollAtEdge,
953953
} = this;
954-
console.log('isSheetModal', isSheetModal, 'scrollAtEdge', scrollAtEdge, 'both', isSheetModal && !scrollAtEdge);
955954
const showHandle = handle !== false && isSheetModal;
956955
const mode = getIonMode(this);
957956
const isCardModal = presentingElement !== undefined && mode === 'ios';

0 commit comments

Comments
 (0)