in-app notification

This commit is contained in:
Diego Mello 2020-05-26 17:02:39 -03:00
parent 3347a6755a
commit 99e4dfcce0
1 changed files with 6 additions and 5 deletions

View File

@ -107,7 +107,7 @@ class NotificationBadge extends React.Component {
const { notification: { payload }, route } = this.props; const { notification: { payload }, route } = this.props;
const navState = this.getNavState(route.state); const navState = this.getNavState(route.state);
if (payload.rid) { if (payload.rid) {
if (navState && navState.routeName === 'RoomView' && navState.params && navState.params.rid === payload.rid) { if (navState && navState.name === 'RoomView' && navState.params && navState.params?.rid === payload.rid) {
return; return;
} }
this.show(); this.show();
@ -151,11 +151,12 @@ class NotificationBadge extends React.Component {
} }
} }
getNavState = (routes) => { getNavState = (state) => {
if (!routes.routes) { const value = state.routes[state.index];
return routes; if (value.state) {
return this.getNavState(value.state);
} }
return this.getNavState(routes.routes[routes.index]); return value;
} }
goToRoom = async() => { goToRoom = async() => {