fix(menu): allow ssr to work properly with hardware back button updates (#20629)

This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
Liam DeBeasi
2020-02-26 15:54:50 -05:00
committed by GitHub
gitea-unlock(16/)
parent 11d8c14d72
commit fe8d74d08c

6
core/src/utils/menu-controller/index.ts
View File

@@ -207,8 +207,9 @@ const createMenuController = () => {
registerAnimation('push', menuPushAnimation); registerAnimation('push', menuPushAnimation);
registerAnimation('overlay', menuOverlayAnimation); registerAnimation('overlay', menuOverlayAnimation);
const doc: Document = document; /* tslint:disable-next-line */
doc.addEventListener('ionBackButton', (ev: any) => { if (typeof document !== 'undefined') {
document.addEventListener('ionBackButton', (ev: any) => {
const openMenu = _getOpenSync(); const openMenu = _getOpenSync();
if (openMenu) { if (openMenu) {
(ev as BackButtonEvent).detail.register(MENU_BACK_BUTTON_PRIORITY, () => { (ev as BackButtonEvent).detail.register(MENU_BACK_BUTTON_PRIORITY, () => {
@@ -216,6 +217,7 @@ const createMenuController = () => {
}); });
} }
}); });
}
return { return {
registerAnimation, registerAnimation,