Chore: Evaluate NewMessageView - TypeScript (#4115)
* Chore: Evaluate NewMessageView - TypeScript * minor tweak
This commit is contained in:
parent
5d29fcad53
commit
bd55fe44ba
|
@ -206,7 +206,7 @@ export type NewMessageStackParamList = {
|
|||
buttonText?: string;
|
||||
nextAction?: Function;
|
||||
}; // TODO: Change
|
||||
CreateChannelView: {
|
||||
CreateChannelView?: {
|
||||
isTeam?: boolean; // TODO: To check
|
||||
teamId?: string;
|
||||
};
|
||||
|
|
|
@ -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<any, 'NewMessageView'> {
|
||||
interface INewMessageViewProps extends IBaseScreen<NewMessageStackParamList, 'NewMessageView'> {
|
||||
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<INewMessageViewProps, INewMessageViewState> {
|
||||
|
@ -167,8 +168,7 @@ class NewMessageView extends React.Component<INewMessageViewProps, INewMessageVi
|
|||
});
|
||||
};
|
||||
|
||||
// TODO: Refactor when migrate room
|
||||
goRoom = (item: any) => {
|
||||
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<INewMessageViewProps, INewMessageVi
|
|||
<UserItem
|
||||
name={itemSearch.search ? itemSearch.name : itemModel.fname || ''}
|
||||
username={itemSearch.search ? itemSearch.username : itemModel.name}
|
||||
onPress={() => this.goRoom(item)}
|
||||
onPress={() => this.goRoom(itemModel)}
|
||||
testID={`new-message-view-item-${item.name}`}
|
||||
style={style}
|
||||
theme={theme}
|
||||
|
|
Loading…
Reference in New Issue