mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-26 13:35:32 +08:00
fix: support platforms without BackHandler (#24)
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user