[FIX] App not sending second argument for EventEmitter.removeListener on some places (#2909)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
3a950547f3
commit
09843aa588
|
@ -28,7 +28,7 @@ class Toast extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
EventEmitter.addEventListener(LISTENER, this.showToast);
|
this.listener = EventEmitter.addEventListener(LISTENER, this.showToast);
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps) {
|
shouldComponentUpdate(nextProps) {
|
||||||
|
@ -40,7 +40,7 @@ class Toast extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
EventEmitter.removeListener(LISTENER);
|
EventEmitter.removeListener(LISTENER, this.listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
getToastRef = toast => this.toast = toast;
|
getToastRef = toast => this.toast = toast;
|
||||||
|
|
|
@ -58,9 +58,9 @@ const TwoFactor = React.memo(({ theme, isMasterDetail }) => {
|
||||||
const showTwoFactor = args => setData(args);
|
const showTwoFactor = args => setData(args);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
EventEmitter.addEventListener(TWO_FACTOR, showTwoFactor);
|
const listener = EventEmitter.addEventListener(TWO_FACTOR, showTwoFactor);
|
||||||
|
|
||||||
return () => EventEmitter.removeListener(TWO_FACTOR);
|
return () => EventEmitter.removeListener(TWO_FACTOR, listener);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onCancel = () => {
|
const onCancel = () => {
|
||||||
|
|
|
@ -63,12 +63,12 @@ const ChangePasscodeView = React.memo(({ theme }) => {
|
||||||
if (!isTablet) {
|
if (!isTablet) {
|
||||||
Orientation.lockToPortrait();
|
Orientation.lockToPortrait();
|
||||||
}
|
}
|
||||||
EventEmitter.addEventListener(CHANGE_PASSCODE_EMITTER, showChangePasscode);
|
const listener = EventEmitter.addEventListener(CHANGE_PASSCODE_EMITTER, showChangePasscode);
|
||||||
return (() => {
|
return (() => {
|
||||||
if (!isTablet) {
|
if (!isTablet) {
|
||||||
Orientation.unlockAllOrientations();
|
Orientation.unlockAllOrientations();
|
||||||
}
|
}
|
||||||
EventEmitter.removeListener(CHANGE_PASSCODE_EMITTER);
|
EventEmitter.removeListener(CHANGE_PASSCODE_EMITTER, listener);
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,12 @@ const ScreenLockedView = ({ theme }) => {
|
||||||
if (!isTablet) {
|
if (!isTablet) {
|
||||||
Orientation.lockToPortrait();
|
Orientation.lockToPortrait();
|
||||||
}
|
}
|
||||||
EventEmitter.addEventListener(LOCAL_AUTHENTICATE_EMITTER, showScreenLock);
|
const listener = EventEmitter.addEventListener(LOCAL_AUTHENTICATE_EMITTER, showScreenLock);
|
||||||
return (() => {
|
return (() => {
|
||||||
if (!isTablet) {
|
if (!isTablet) {
|
||||||
Orientation.unlockAllOrientations();
|
Orientation.unlockAllOrientations();
|
||||||
}
|
}
|
||||||
EventEmitter.removeListener(LOCAL_AUTHENTICATE_EMITTER);
|
EventEmitter.removeListener(LOCAL_AUTHENTICATE_EMITTER, listener);
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue