From bd55fe44bacc8d595cfdf8ce230e9b57a955fa42 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Mon, 2 May 2022 23:43:30 -0300 Subject: [PATCH] Chore: Evaluate NewMessageView - TypeScript (#4115) * Chore: Evaluate NewMessageView - TypeScript * minor tweak --- app/stacks/types.ts | 2 +- app/views/NewMessageView.tsx | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/stacks/types.ts b/app/stacks/types.ts index 31c85ad5e..8d186ffb1 100644 --- a/app/stacks/types.ts +++ b/app/stacks/types.ts @@ -206,7 +206,7 @@ export type NewMessageStackParamList = { buttonText?: string; nextAction?: Function; }; // TODO: Change - CreateChannelView: { + CreateChannelView?: { isTeam?: boolean; // TODO: To check teamId?: string; }; diff --git a/app/views/NewMessageView.tsx b/app/views/NewMessageView.tsx index 92610f105..00394c62c 100644 --- a/app/views/NewMessageView.tsx +++ b/app/views/NewMessageView.tsx @@ -20,10 +20,11 @@ import Navigation from '../lib/navigation/appNavigation'; import { compareServerVersion } from '../lib/methods/helpers/compareServerVersion'; import UserItem from '../containers/UserItem'; import { withTheme } from '../theme'; -import { goRoom } from '../utils/goRoom'; +import { goRoom, TGoRoomItem } from '../utils/goRoom'; import log, { events, logEvent } from '../utils/log'; import Touch from '../utils/touch'; import sharedStyles from './Styles'; +import { NewMessageStackParamList } from '../stacks/types'; import { hasPermission, search } from '../lib/methods'; const QUERY_SIZE = 50; @@ -61,15 +62,15 @@ interface INewMessageViewState { permissions: boolean[]; } -interface INewMessageViewProps extends IBaseScreen { +interface INewMessageViewProps extends IBaseScreen { maxUsers: number; isMasterDetail: boolean; serverVersion: string; - createTeamPermission: string[] | undefined; - createDirectMessagePermission: string[] | undefined; - createPublicChannelPermission: string[] | undefined; - createPrivateChannelPermission: string[] | undefined; - createDiscussionPermission: string[] | undefined; + createTeamPermission?: string[]; + createDirectMessagePermission?: string[]; + createPublicChannelPermission?: string[]; + createPrivateChannelPermission?: string[]; + createDiscussionPermission?: string[]; } class NewMessageView extends React.Component { @@ -167,8 +168,7 @@ class NewMessageView extends React.Component { + goRoom = (item: TGoRoomItem) => { logEvent(events.NEW_MSG_CHAT_WITH_USER); const { isMasterDetail, navigation } = this.props; if (isMasterDetail) { @@ -286,7 +286,7 @@ class NewMessageView extends React.Component this.goRoom(item)} + onPress={() => this.goRoom(itemModel)} testID={`new-message-view-item-${item.name}`} style={style} theme={theme}