forked from vergnet/application-amicale
Do not create listeners on each focus
This commit is contained in:
parent
a54493a23f
commit
8e2d1c7a2b
1 changed files with 2 additions and 2 deletions
|
@ -68,6 +68,8 @@ class HomeScreen extends React.Component<Props> {
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.navigation.addListener('focus', this.onScreenFocus);
|
this.props.navigation.addListener('focus', this.onScreenFocus);
|
||||||
|
// Handle link open when home is focused
|
||||||
|
this.props.navigation.addListener('state', this.handleNavigationParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
onScreenFocus = () => {
|
onScreenFocus = () => {
|
||||||
|
@ -77,8 +79,6 @@ class HomeScreen extends React.Component<Props> {
|
||||||
headerRight: this.getHeaderButton,
|
headerRight: this.getHeaderButton,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Handle link open when home is focused
|
|
||||||
this.props.navigation.addListener('state', this.handleNavigationParams);
|
|
||||||
// handle link open when home is not focused or created
|
// handle link open when home is not focused or created
|
||||||
this.handleNavigationParams();
|
this.handleNavigationParams();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue