Remove BackAndroid, which has had a deprecation warning (#21866)

Summary:
Remove BackAndroid, which has had a deprecation warning and only forwarded to BackHandler since March 2018.

Test Plan
---------
React-native init bundle and RNTester bundle works.

Release Notes:
--------------
[ ANDROID  ] [ BREAKING ] [ BackAndroid ] - Deprecate BackAndroid since BackHandler should be used in its place.
Pull Request resolved: https://github.com/facebook/react-native/pull/21866

Differential Revision: D10472419

Pulled By: TheSavior

fbshipit-source-id: 3d76e1ce4c74bb783fee7fd8232bb366f2e7ea12
This commit is contained in:
Ryan Dy
2018-10-19 15:59:06 -07:00
committed by Facebook Github Bot
parent 6b0e924915
commit 774cd73663
2 changed files with 0 additions and 57 deletions

View File

@@ -1,54 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* BackAndroid has been moved to BackHandler. This stub calls BackHandler methods
* after generating a warning to remind users to move to the new BackHandler module.
*
* @format
*/
'use strict';
const BackHandler = require('BackHandler');
const warning = require('fbjs/lib/warning');
/**
* Deprecated. Use BackHandler instead.
*/
const BackAndroid = {
exitApp: function() {
warning(
false,
'BackAndroid is deprecated. Please use BackHandler instead.',
);
BackHandler.exitApp();
},
addEventListener: function(
eventName: BackPressEventName,
handler: Function,
): {remove: () => void} {
warning(
false,
'BackAndroid is deprecated. Please use BackHandler instead.',
);
return BackHandler.addEventListener(eventName, handler);
},
removeEventListener: function(
eventName: BackPressEventName,
handler: Function,
): void {
warning(
false,
'BackAndroid is deprecated. Please use BackHandler instead.',
);
BackHandler.removeEventListener(eventName, handler);
},
};
module.exports = BackAndroid;

View File

@@ -195,9 +195,6 @@ module.exports = {
get AsyncStorage() {
return require('AsyncStorage');
},
get BackAndroid() {
return require('BackAndroid');
}, // deprecated: use BackHandler instead
get BackHandler() {
return require('BackHandler');
},