mirror of
https://github.com/zoriya/react-native-web.git
synced 2025-12-06 06:36:13 +00:00
[fix] Reintroduce BackHandler with console.error
This API will be removed in a future version.
This commit is contained in:
@@ -7,6 +7,7 @@ module.exports = {
|
||||
AppRegistry: true,
|
||||
AppState: true,
|
||||
Appearance: true,
|
||||
BackHandler: true,
|
||||
Button: true,
|
||||
CheckBox: true,
|
||||
Clipboard: true,
|
||||
|
||||
26
packages/react-native-web/src/exports/BackHandler/index.js
vendored
Normal file
26
packages/react-native-web/src/exports/BackHandler/index.js
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) Nicolas Gallagher.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
function emptyFunction() {}
|
||||
|
||||
const BackHandler = {
|
||||
exitApp: emptyFunction,
|
||||
addEventListener(): {| remove: () => void |} {
|
||||
console.error(
|
||||
'BackHandler is not supported on web and should not be used.'
|
||||
);
|
||||
return {
|
||||
remove: emptyFunction
|
||||
};
|
||||
},
|
||||
removeEventListener: emptyFunction
|
||||
};
|
||||
|
||||
export default BackHandler;
|
||||
1
packages/react-native-web/src/index.js
vendored
1
packages/react-native-web/src/index.js
vendored
@@ -13,6 +13,7 @@ export { default as Animated } from './exports/Animated';
|
||||
export { default as Appearance } from './exports/Appearance';
|
||||
export { default as AppRegistry } from './exports/AppRegistry';
|
||||
export { default as AppState } from './exports/AppState';
|
||||
export { default as BackHandler } from './exports/BackHandler';
|
||||
export { default as Clipboard } from './exports/Clipboard';
|
||||
export { default as Dimensions } from './exports/Dimensions';
|
||||
export { default as Easing } from './exports/Easing';
|
||||
|
||||
Reference in New Issue
Block a user