Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close the new chat page when pressing the back button #35568

Merged
merged 6 commits into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading