Fix switch to channel when notification is dismissed (#6675)

This commit is contained in:
Elias Nahum
2022-10-11 10:36:45 -03:00
committed by GitHub
parent 391c120db9
commit e1c74124e2
4 changed files with 10 additions and 7 deletions

View File

@@ -149,6 +149,12 @@ export const SCREENS_WITH_TRANSPARENT_BACKGROUND = new Set<string>([
USER_PROFILE,
]);
export const OVERLAY_SCREENS = new Set<string>([
IN_APP_NOTIFICATION,
GALLERY,
SNACK_BAR,
]);
export const NOT_READY = [
CHANNEL_ADD_PEOPLE,
CHANNEL_MENTION,

View File

@@ -113,7 +113,6 @@ class PushNotifications {
const screen = Screens.IN_APP_NOTIFICATION;
const passProps = {
notification,
overlay: true,
serverName,
serverUrl,
};

View File

@@ -615,10 +615,7 @@ export function showOverlay(name: string, passProps = {}, options = {}) {
component: {
id: name,
name,
passProps: {
...passProps,
overlay: true,
},
passProps,
options: merge(defaultOptions, options),
},
});

View File

@@ -8,6 +8,7 @@ import 'react-native-gesture-handler';
import {ComponentDidAppearEvent, ComponentDidDisappearEvent, ModalDismissedEvent, Navigation, ScreenPoppedEvent} from 'react-native-navigation';
import {Events, Screens} from './app/constants';
import {OVERLAY_SCREENS} from './app/constants/screens';
import DatabaseManager from './app/database/manager';
import {getAllServerCredentials} from './app/init/credentials';
import {initialLaunch} from './app/init/launch';
@@ -98,8 +99,8 @@ function screenWillAppear({componentId}: ComponentDidAppearEvent) {
}
}
function screenDidAppearListener({componentId, passProps, componentType}: ComponentDidAppearEvent) {
if (!(passProps as any)?.overlay && componentType === 'Component') {
function screenDidAppearListener({componentId, componentType}: ComponentDidAppearEvent) {
if (!OVERLAY_SCREENS.has(componentId) && componentType === 'Component') {
NavigationStore.addNavigationComponentId(componentId);
}
}