diff --git a/core/src/components/menu/menu-interface.ts b/core/src/components/menu/menu-interface.ts index a6fc586141..6c21ec930b 100644 --- a/core/src/components/menu/menu-interface.ts +++ b/core/src/components/menu/menu-interface.ts @@ -1,8 +1,8 @@ import { Animation, Side } from '../../interface'; export interface MenuI { - el: HTMLIonMenuElement; + mode: string; side: Side; menuId?: string; disabled: boolean; diff --git a/core/src/components/menu/menu.md.vars.scss b/core/src/components/menu/menu.md.vars.scss index de2830d1fb..064c8f4776 100644 --- a/core/src/components/menu/menu.md.vars.scss +++ b/core/src/components/menu/menu.md.vars.scss @@ -7,4 +7,4 @@ $menu-md-background: $background-color !default; /// @prop - Box shadow of the menu -$menu-md-box-shadow: 0 2px 22px 0 rgba(0, 0, 0, 0.09), 4px 0 16px 0 rgba(0, 0, 0, 0.18) !default; +$menu-md-box-shadow: 4px 0px 16px rgba(0, 0, 0, 0.18) !default; diff --git a/core/src/components/menu/menu.tsx b/core/src/components/menu/menu.tsx index 6bc05d315e..9a0d2ebd5f 100644 --- a/core/src/components/menu/menu.tsx +++ b/core/src/components/menu/menu.tsx @@ -8,6 +8,11 @@ import { GESTURE_CONTROLLER } from '../../utils/gesture'; import { assert, isEndSide as isEnd } from '../../utils/helpers'; import { menuController } from '../../utils/menu-controller'; +const iosEasing = 'cubic-bezier(0.32,0.72,0,1)'; +const mdEasing = 'cubic-bezier(0.0,0.0,0.2,1)'; +const iosEasingReverse = 'cubic-bezier(1, 0, 0.68, 0.28)'; +const mdEasingReverse = 'cubic-bezier(0.4, 0, 0.6, 1)'; + @Component({ tag: 'ion-menu', styleUrls: { @@ -23,7 +28,10 @@ export class Menu implements ComponentInterface, MenuI { private gesture?: Gesture; private blocker = GESTURE_CONTROLLER.createBlocker({ disableScroll: true }); - private mode = getIonMode(this); + mode = getIonMode(this); + + private easing: string = this.mode === 'ios' ? iosEasing : mdEasing; + private easingReverse: string = this.mode === 'ios' ? iosEasingReverse : mdEasingReverse; isAnimating = false; width!: number; // TODO @@ -138,7 +146,7 @@ export class Menu implements ComponentInterface, MenuI { async connectedCallback() { if (this.type === undefined) { - this.type = config.get('menuType', this.mode === 'ios' ? 'reveal' : 'overlay'); + this.type = config.get('menuType', 'overlay'); } if (!Build.isBrowser) { @@ -329,12 +337,12 @@ AFTER: const isReversed = !shouldOpen; const ani = (this.animation as IonicAnimation)! .direction((isReversed) ? 'reverse' : 'normal') - .easing((isReversed) ? 'cubic-bezier(0.4, 0.0, 0.6, 1)' : 'cubic-bezier(0.0, 0.0, 0.2, 1)'); + .easing((isReversed) ? this.easingReverse : this.easing); if (animated) { - await ani.playAsync(); + await ani.play(); } else { - ani.playSync(); + ani.play({ sync: true }); } } @@ -532,7 +540,7 @@ AFTER: this.isAnimating = true; const ani = (this.animation as IonicAnimation)!.direction('reverse'); - ani.playSync(); + ani.play({ sync: true }); this.afterAnimation(false); } diff --git a/core/src/components/menu/test/basic/index.html b/core/src/components/menu/test/basic/index.html index c5474a06f6..0cac916ea3 100644 --- a/core/src/components/menu/test/basic/index.html +++ b/core/src/components/menu/test/basic/index.html @@ -93,7 +93,7 @@ } -