From 41ddb5cc1a62a27ccae1d7c6ffdcfc01bf760f4b Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Fri, 9 Aug 2019 17:06:16 +0200 Subject: [PATCH] Fix pop thread screen when deleting the root post (#3093) --- app/actions/navigation.js | 11 +++++++---- app/screens/thread/thread_base.js | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/actions/navigation.js b/app/actions/navigation.js index d4cd69ad2..5d6828dcb 100644 --- a/app/actions/navigation.js +++ b/app/actions/navigation.js @@ -166,11 +166,14 @@ export function goToScreen(name, title, passProps = {}, options = {}) { }; } -export function popTopScreen() { +export function popTopScreen(screenId) { return () => { - const componentId = EphemeralStore.getNavigationTopComponentId(); - - Navigation.pop(componentId); + if (screenId) { + Navigation.pop(screenId); + } else { + const componentId = EphemeralStore.getNavigationTopComponentId(); + Navigation.pop(componentId); + } }; } diff --git a/app/screens/thread/thread_base.js b/app/screens/thread/thread_base.js index 0b64e7e32..50c733642 100644 --- a/app/screens/thread/thread_base.js +++ b/app/screens/thread/thread_base.js @@ -88,7 +88,8 @@ export default class ThreadBase extends PureComponent { } close = () => { - this.props.actions.popTopScreen(); + const {actions, componentId} = this.props; + actions.popTopScreen(componentId); }; handleAutoComplete = (value) => {