Skip to content

Commit

Permalink
Merge pull request #35568 from bernhardoj/fix/35143-new-chat-navigation
Browse files Browse the repository at this point in the history
Close the new chat page when pressing the back button
  • Loading branch information
Beamanator authored Feb 26, 2024
2 parents 4b31f4b + 33361bf commit f4a16f3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pages/NewChatSelectorPage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useNavigation} from '@react-navigation/native';
import React from 'react';
import {withOnyx} from 'react-native-onyx';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
Expand All @@ -6,7 +7,6 @@ import TabSelector from '@components/TabSelector/TabSelector';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
import OnyxTabNavigator, {TopTab} from '@libs/Navigation/OnyxTabNavigator';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand All @@ -26,6 +26,8 @@ const defaultProps = {
};

function NewChatSelectorPage(props) {
const navigation = useNavigation();

return (
<ScreenWrapper
shouldEnableKeyboardAvoidingView={false}
Expand All @@ -36,14 +38,14 @@ function NewChatSelectorPage(props) {
>
<HeaderWithBackButton
title={props.translate('sidebarScreen.fabNewChat')}
onBackButtonPress={() => Navigation.dismissModal()}
onBackButtonPress={navigation.goBack}
/>
<OnyxTabNavigator
id={CONST.TAB.NEW_CHAT_TAB_ID}
tabBar={({state, navigation, position}) => (
tabBar={({state, navigation: tabNavigation, position}) => (
<TabSelector
state={state}
navigation={navigation}
navigation={tabNavigation}
position={position}
/>
)}
Expand Down

0 comments on commit f4a16f3

Please sign in to comment.