fixed polyfill for BackAndroid

Summary:
`BackAndroid.addEventListener()` returns a subscription object with a `remove()` function in android. Before this fix, the iOS equivalent doesn't return anything, which means, if there's a component doing something like this, it would redbox:

```
componentWillMount() {
  this._subscription = BackAndroid.addEventListener('hardwareBackPress', () => {...});
}

componentWillUnmount() {
  this._subscription.remove(); // --> redbox in iOS before this fix
}
```

Differential Revision: D3790480

fbshipit-source-id: 1e607171bf2892a6b64977c4fd052c5df0bc4a0d
This commit is contained in:
Kevin Gozali 2016-08-30 10:47:54 -07:00 committed by Facebook Github Bot 6
parent 0a1d7280eb
commit 150fe7cb9c
1 changed files with 5 additions and 1 deletions

View File

@ -17,7 +17,11 @@ function emptyFunction() {}
const BackAndroid = {
exitApp: emptyFunction,
addEventListener: emptyFunction,
addEventListener() {
return {
remove: emptyFunction,
};
},
removeEventListener: emptyFunction,
};