[MM-41749] Fixed SettingsSidebar component added back to navigation stack (#6503) (#6545)

Co-authored-by: Jean-Paul Manuel <jean-paulm@yoyowallet.com>
(cherry picked from commit 8cbf57781b)

Co-authored-by: Jean-Paul Manuel <jpmastermind@gmail.com>
This commit is contained in:
Mattermost Build 2022-08-04 16:41:32 +03:00 committed by GitHub
parent 19be35c343
commit 8e26b4b2b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 13 deletions

View file

@ -140,18 +140,16 @@ export function componentDidDisappearListener({componentId}) {
if (componentId === 'MainSidebar') {
EventEmitter.emit(NavigationTypes.MAIN_SIDEBAR_DID_CLOSE);
}
if (componentId === THREAD) {
if (EphemeralStore.hasModalsOpened()) {
for (const modal of EphemeralStore.navigationModalStack) {
const enableSwipe = {
modal: {
swipeToDismiss: true,
},
};
Navigation.mergeOptions(modal, enableSwipe);
}
} else if (componentId === 'SettingsSidebar') {
EventEmitter.emit(NavigationTypes.CLOSE_SETTINGS_SIDEBAR);
} else if (componentId === THREAD && EphemeralStore.hasModalsOpened()) {
for (const modal of EphemeralStore.navigationModalStack) {
const enableSwipe = {
modal: {
swipeToDismiss: true,
},
};
Navigation.mergeOptions(modal, enableSwipe);
}
}
}

View file

@ -41,7 +41,7 @@ class EphemeralStore {
addToNavigationComponentIdStack = (componentId) => {
const index = this.navigationComponentIdStack.indexOf(componentId);
if (index > 0) {
if (index >= 0) {
this.navigationComponentIdStack.slice(index, 1);
}