-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[TS migration] Migrate 'NewChatSelector' page to TypeScript... #38441
Changes from 1 commit
122cf2b
3b0ded7
99b6eff
c50a407
84a90b4
4aed738
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,51 +1,38 @@ | ||||||||||||||||||
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 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'; | ||||||||||||||||||
import useLocalize from '@hooks/useLocalize'; | ||||||||||||||||||
|
||||||||||||||||||
const propTypes = { | ||||||||||||||||||
...windowDimensionsPropTypes, | ||||||||||||||||||
|
||||||||||||||||||
...withLocalizePropTypes, | ||||||||||||||||||
}; | ||||||||||||||||||
|
||||||||||||||||||
const defaultProps = { | ||||||||||||||||||
betas: [], | ||||||||||||||||||
personalDetails: {}, | ||||||||||||||||||
reports: {}, | ||||||||||||||||||
}; | ||||||||||||||||||
|
||||||||||||||||||
function NewChatSelectorPage(props) { | ||||||||||||||||||
const navigation = useNavigation(); | ||||||||||||||||||
|
||||||||||||||||||
function NewChatSelectorPage() { | ||||||||||||||||||
const {translate} = useLocalize(); | ||||||||||||||||||
return ( | ||||||||||||||||||
<ScreenWrapper | ||||||||||||||||||
<ScreenWrapper | ||||||||||||||||||
shouldEnableKeyboardAvoidingView={false} | ||||||||||||||||||
includeSafeAreaPaddingBottom={false} | ||||||||||||||||||
shouldShowOfflineIndicator={false} | ||||||||||||||||||
shouldEnableMaxHeight | ||||||||||||||||||
testID={NewChatSelectorPage.displayName} | ||||||||||||||||||
> | ||||||||||||||||||
<HeaderWithBackButton | ||||||||||||||||||
title={props.translate('sidebarScreen.fabNewChat')} | ||||||||||||||||||
onBackButtonPress={navigation.goBack} | ||||||||||||||||||
/> | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||||||||||||||||
<HeaderWithBackButton title={translate('sidebarScreen.fabNewChat')} /> | ||||||||||||||||||
<OnyxTabNavigator | ||||||||||||||||||
id={CONST.TAB.NEW_CHAT_TAB_ID} | ||||||||||||||||||
tabBar={TabSelector} | ||||||||||||||||||
tabBar={({state, navigation, position}) => ( | ||||||||||||||||||
<TabSelector | ||||||||||||||||||
state={state} | ||||||||||||||||||
navigation={navigation} | ||||||||||||||||||
position={position} | ||||||||||||||||||
/> | ||||||||||||||||||
)} | ||||||||||||||||||
> | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. Will do it. |
||||||||||||||||||
<TopTab.Screen | ||||||||||||||||||
name={CONST.TAB.NEW_CHAT} | ||||||||||||||||||
// @ts-expect-error TODO: 'isGroupChat' is declared here. | ||||||||||||||||||
component={NewChatPage} | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's remove this ts expect error, instead let's make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. |
||||||||||||||||||
/> | ||||||||||||||||||
<TopTab.Screen | ||||||||||||||||||
|
@@ -57,14 +44,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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a space added? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.