Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 4 additions & 13 deletions src/components/TabSelector/TabSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {MaterialTopTabNavigationHelpers} from '@react-navigation/material-top-tabs/lib/typescript/src/types';
import type {TabNavigationState} from '@react-navigation/native';
import type {MaterialTopTabBarProps} from '@react-navigation/material-top-tabs/lib/typescript/src/types';
import React, {useCallback, useEffect, useMemo, useState} from 'react';
import type {Animated} from 'react-native';
import {View} from 'react-native';
Expand All @@ -8,23 +7,13 @@ import type {LocaleContextProps} from '@components/LocaleContextProvider';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import type {RootStackParamList} from '@libs/Navigation/types';
import CONST from '@src/CONST';
import type IconAsset from '@src/types/utils/IconAsset';
import TabSelectorItem from './TabSelectorItem';

type TabSelectorProps = {
/* Navigation state provided by React Navigation */
state: TabNavigationState<RootStackParamList>;

/* Navigation functions provided by React Navigation */
navigation: MaterialTopTabNavigationHelpers;

type TabSelectorProps = MaterialTopTabBarProps & {
/* Callback fired when tab is pressed */
onTabPress?: (name: string) => void;

/* AnimatedValue for the position of the screen while swiping */
position: Animated.AnimatedInterpolation<number | string>;
};

type IconAndTitle = {
Expand Down Expand Up @@ -143,3 +132,5 @@ function TabSelector({state, navigation, onTabPress = () => {}, position}: TabSe
TabSelector.displayName = 'TabSelector';

export default TabSelector;

export type {TabSelectorProps};
3 changes: 3 additions & 0 deletions src/libs/Navigation/OnyxTabNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {EventMapCore, NavigationState, ScreenListeners} from '@react-naviga
import React from 'react';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import type {TabSelectorProps} from '@components/TabSelector/TabSelector';
import Tab from '@userActions/Tab';
import ONYXKEYS from '@src/ONYXKEYS';
import type ChildrenProps from '@src/types/utils/ChildrenProps';
Expand All @@ -24,6 +25,8 @@ type OnyxTabNavigatorProps = OnyxTabNavigatorOnyxProps &
/** A function triggered when a tab has been selected */
onTabSelected?: (newIouType: string) => void;

tabBar: (props: TabSelectorProps) => React.ReactNode;

screenListeners?: ScreenListeners<NavigationState, MaterialTopTabNavigationEventMap>;
};

Expand Down
2 changes: 1 addition & 1 deletion src/pages/NewChatPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type NewChatPageWithOnyxProps = {
};

type NewChatPageProps = NewChatPageWithOnyxProps & {
isGroupChat: boolean;
isGroupChat?: boolean;
};

const excludedGroupEmails = CONST.EXPENSIFY_EMAILS.filter((value) => value !== CONST.EMAIL.CONCIERGE);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
import {useNavigation} from '@react-navigation/native';
import React from 'react';
import {withOnyx} from 'react-native-onyx';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ScreenWrapper from '@components/ScreenWrapper';
import TabSelector from '@components/TabSelector/TabSelector';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import compose from '@libs/compose';
import useLocalize from '@hooks/useLocalize';
import OnyxTabNavigator, {TopTab} from '@libs/Navigation/OnyxTabNavigator';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import NewChatPage from './NewChatPage';
import WorkspaceNewRoomPage from './workspace/WorkspaceNewRoomPage';

const propTypes = {
...windowDimensionsPropTypes,

...withLocalizePropTypes,
};

const defaultProps = {
betas: [],
personalDetails: {},
reports: {},
};

function NewChatSelectorPage(props) {
function NewChatSelectorPage() {
const {translate} = useLocalize();
const navigation = useNavigation();

return (
Expand All @@ -37,7 +22,7 @@ function NewChatSelectorPage(props) {
testID={NewChatSelectorPage.displayName}
>
<HeaderWithBackButton
title={props.translate('sidebarScreen.fabNewChat')}
title={translate('sidebarScreen.fabNewChat')}
onBackButtonPress={navigation.goBack}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied and pasted last changes. Maybe this caused some issues. I'll fix them.

/>
<OnyxTabNavigator
Expand All @@ -57,14 +42,6 @@ function NewChatSelectorPage(props) {
);
}

NewChatSelectorPage.propTypes = propTypes;
NewChatSelectorPage.defaultProps = defaultProps;
NewChatSelectorPage.displayName = 'NewChatSelectorPage';

export default compose(
withLocalize,
withWindowDimensions,
withOnyx({
betas: {key: ONYXKEYS.BETAS},
}),
)(NewChatSelectorPage);
export default NewChatSelectorPage;