Skip to content

Commit

Permalink
fix(react): adding hardware back button support, fixes(19819) (#19851)
Browse files Browse the repository at this point in the history
  • Loading branch information
elylucas committed Nov 6, 2019
1 parent bcc40c8 commit fd9745d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/react-router/src/ReactRouter/NavManager.tsx
Expand Up @@ -34,6 +34,13 @@ export class NavManager extends React.Component<NavManagerProps, NavContextState
});
});

if (document) {
document.addEventListener('ionBackButton', (e: any) => {
e.detail.register(0, () => {
this.props.history.goBack();
});
});
}
}

componentWillUnmount() {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/utils/index.tsx
@@ -1,4 +1,4 @@
import { Platforms, getPlatforms as getPlatformsCore, isPlatform as isPlatformCore, Config as CoreConfig } from '@ionic/core';
import { Config as CoreConfig, Platforms, getPlatforms as getPlatformsCore, isPlatform as isPlatformCore } from '@ionic/core';
import React from 'react';

import { IonicReactProps } from '../IonicReactProps';
Expand Down

0 comments on commit fd9745d

Please sign in to comment.