2017-03-07 05:41:51 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2017-03-07 05:41:51 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-03-07 05:41:51 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2018-05-11 02:06:46 +00:00
|
|
|
* @format
|
2017-03-07 05:41:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2018-05-10 22:44:52 +00:00
|
|
|
const BackHandler = require('BackHandler');
|
2017-03-07 05:41:51 +00:00
|
|
|
|
2018-05-10 22:44:52 +00:00
|
|
|
const warning = require('fbjs/lib/warning');
|
2017-03-07 05:41:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Deprecated. Use BackHandler instead.
|
|
|
|
*/
|
2018-05-10 22:44:52 +00:00
|
|
|
const BackAndroid = {
|
2017-03-07 05:41:51 +00:00
|
|
|
exitApp: function() {
|
2018-05-11 02:06:46 +00:00
|
|
|
warning(
|
|
|
|
false,
|
|
|
|
'BackAndroid is deprecated. Please use BackHandler instead.',
|
|
|
|
);
|
2017-03-07 05:41:51 +00:00
|
|
|
BackHandler.exitApp();
|
|
|
|
},
|
|
|
|
|
2018-05-11 02:06:46 +00:00
|
|
|
addEventListener: function(
|
2017-03-07 05:41:51 +00:00
|
|
|
eventName: BackPressEventName,
|
2018-05-11 02:06:46 +00:00
|
|
|
handler: Function,
|
2017-03-07 05:41:51 +00:00
|
|
|
): {remove: () => void} {
|
2018-05-11 02:06:46 +00:00
|
|
|
warning(
|
|
|
|
false,
|
|
|
|
'BackAndroid is deprecated. Please use BackHandler instead.',
|
|
|
|
);
|
2017-03-07 05:41:51 +00:00
|
|
|
return BackHandler.addEventListener(eventName, handler);
|
|
|
|
},
|
|
|
|
|
|
|
|
removeEventListener: function(
|
|
|
|
eventName: BackPressEventName,
|
2018-05-11 02:06:46 +00:00
|
|
|
handler: Function,
|
2017-03-07 05:41:51 +00:00
|
|
|
): void {
|
2018-05-11 02:06:46 +00:00
|
|
|
warning(
|
|
|
|
false,
|
|
|
|
'BackAndroid is deprecated. Please use BackHandler instead.',
|
|
|
|
);
|
2017-03-07 05:41:51 +00:00
|
|
|
BackHandler.removeEventListener(eventName, handler);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = BackAndroid;
|