Skip to content

Commit

Permalink
Merge pull request #2789 from myxmaster/fix-lnc-activity-unsubscribe
Browse files Browse the repository at this point in the history
Activity: fix removing LNC listeners
  • Loading branch information
kaloudis authored Feb 5, 2025
2 parents 0e6a367 + eb959db commit 2012ac8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions views/Activity/Activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
Text,
TouchableOpacity,
View,
StyleSheet
StyleSheet,
EmitterSubscription
} from 'react-native';
import { Button, Icon, ListItem } from 'react-native-elements';
import { inject, observer } from 'mobx-react';
Expand Down Expand Up @@ -327,8 +328,8 @@ export default class Activity extends React.PureComponent<
ActivityProps,
ActivityState
> {
transactionListener: any;
invoicesListener: any;
private transactionListener: EmitterSubscription;
private invoicesListener: EmitterSubscription;

state = {
loading: false,
Expand Down Expand Up @@ -357,10 +358,8 @@ export default class Activity extends React.PureComponent<
};

componentWillUnmount() {
if (this.transactionListener && this.transactionListener.stop)
this.transactionListener.stop();
if (this.invoicesListener && this.invoicesListener.stop)
this.invoicesListener.stop();
if (this.transactionListener) this.transactionListener.remove();
if (this.invoicesListener) this.invoicesListener.remove();
}

subscribeEvents = () => {
Expand Down

0 comments on commit 2012ac8

Please sign in to comment.