mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
Return objects with remove methods when subscribing to back or host state
Reviewed By: fkgozali Differential Revision: D2907942 fb-gh-sync-id: 11666f2f8cd2432c42cc90bbf48ead02a75f8bc4
This commit is contained in:
committed by
facebook-github-bot-9
parent
cc926211b6
commit
8f6e074bd6
@@ -59,8 +59,11 @@ var BackAndroid = {
|
|||||||
addEventListener: function (
|
addEventListener: function (
|
||||||
eventName: BackPressEventName,
|
eventName: BackPressEventName,
|
||||||
handler: Function
|
handler: Function
|
||||||
): void {
|
): {remove: () => void} {
|
||||||
_backPressSubscriptions.add(handler);
|
_backPressSubscriptions.add(handler);
|
||||||
|
return {
|
||||||
|
remove: () => BackAndroid.removeEventListener(eventName, handler),
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
removeEventListener: function(
|
removeEventListener: function(
|
||||||
|
|||||||
Reference in New Issue
Block a user