mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
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 => {
|
||||
|
||||
Reference in New Issue
Block a user