fix: support platforms without BackHandler (#24)

This commit is contained in:
Joe Lynch
2019-05-16 02:29:29 -07:00
parent 9bdc229faa
commit 54e87e5e30

View File

@@ -81,7 +81,11 @@ export default function createNavigationContainer(Component) {
this._initialAction = NavigationActions.init();
if (this._isStateful()) {
if (
this._isStateful() &&
BackHandler &&
typeof BackHandler.addEventListener === 'function'
) {
this.subs = BackHandler.addEventListener('hardwareBackPress', () => {
if (!this._isMounted) {
this.subs && this.subs.remove();