forked from vergnet/application-amicale
Allow links to open if home is already focused
This commit is contained in:
parent
6a6049220d
commit
a54493a23f
1 changed files with 7 additions and 1 deletions
|
@ -77,7 +77,13 @@ class HomeScreen extends React.Component<Props> {
|
||||||
headerRight: this.getHeaderButton,
|
headerRight: this.getHeaderButton,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// TODO if already on home screen
|
// Handle link open when home is focused
|
||||||
|
this.props.navigation.addListener('state', this.handleNavigationParams);
|
||||||
|
// handle link open when home is not focused or created
|
||||||
|
this.handleNavigationParams();
|
||||||
|
};
|
||||||
|
|
||||||
|
handleNavigationParams = () => {
|
||||||
if (this.props.route.params !== undefined) {
|
if (this.props.route.params !== undefined) {
|
||||||
if (this.props.route.params.shouldOpen !== undefined && this.props.route.params.shouldOpen) {
|
if (this.props.route.params.shouldOpen !== undefined && this.props.route.params.shouldOpen) {
|
||||||
this.props.navigation.navigate(this.props.route.params.nextScreen, this.props.route.params.data);
|
this.props.navigation.navigate(this.props.route.params.nextScreen, this.props.route.params.data);
|
||||||
|
|
Loading…
Reference in a new issue