mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-03-06 17:34:59 +08:00
BackAndroid -> BackHandler
This commit is contained in:
@@ -6,6 +6,6 @@ export const Linking = {
|
||||
getInitialURL: () => Promise.reject('Unsupported platform'),
|
||||
};
|
||||
|
||||
export const BackAndroid = {
|
||||
export const BackHandler = {
|
||||
addEventListener: () => {},
|
||||
};
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
import {
|
||||
BackAndroid as DeprecatedBackAndroid,
|
||||
BackHandler,
|
||||
BackHandler as ModernBackHandler,
|
||||
Linking,
|
||||
} from 'react-native';
|
||||
|
||||
const BackAndroid = BackHandler || DeprecatedBackAndroid;
|
||||
const BackHandler = ModernBackHandler || DeprecatedBackAndroid;
|
||||
|
||||
export { BackAndroid, Linking };
|
||||
export { BackHandler, Linking };
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import invariant from './utils/invariant';
|
||||
import { BackAndroid, Linking } from './PlatformHelpers';
|
||||
import { BackHandler, Linking } from './PlatformHelpers';
|
||||
import NavigationActions from './NavigationActions';
|
||||
import addNavigationHelpers from './addNavigationHelpers';
|
||||
|
||||
@@ -154,7 +154,7 @@ export default function createNavigationContainer<T: *>(
|
||||
return;
|
||||
}
|
||||
|
||||
this.subs = BackAndroid.addEventListener('backPress', () =>
|
||||
this.subs = BackHandler.addEventListener('hardwareBackPress', () =>
|
||||
this.dispatch(NavigationActions.back())
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user