RN: Upgrade AccessibilityInfo.removeEventListener Call Sites

Summary:
Upgrades all users of `AccessibilityInfo.removeEventListener` to instead use the return value of `AccessibilityInfo.addEventListener`. This will avoid soft errors from being fired for Facebook products.

Changelog:
[Internal]

Reviewed By: kacieb

Differential Revision: D27595097

fbshipit-source-id: 7133db83c6313ae04e43fc0cc8667f562ba1af2b
This commit is contained in:
Tim Yung
2021-04-08 17:37:08 -07:00
committed by Facebook GitHub Bot
parent e7275d5c1b
commit ebdf36c198
@@ -837,7 +837,7 @@ class EnabledExample extends React.Component<{}> {
};
componentDidMount() {
AccessibilityInfo.addEventListener(
this._subscription = AccessibilityInfo.addEventListener(
this.props.eventListener,
this._handleToggled,
);
@@ -853,10 +853,7 @@ class EnabledExample extends React.Component<{}> {
}
componentWillUnmount() {
AccessibilityInfo.removeEventListener(
this.props.eventListener,
this._handleToggled,
);
this._subscription?.remove();
}
_handleToggled = isEnabled => {