diff --git a/app/views/RoomView/LoadMore/index.tsx b/app/views/RoomView/LoadMore/index.tsx index 143479152..9ea19823b 100644 --- a/app/views/RoomView/LoadMore/index.tsx +++ b/app/views/RoomView/LoadMore/index.tsx @@ -21,7 +21,7 @@ const styles = StyleSheet.create({ }); interface IRoomLoadMoreProps { - load(): Promise; + load(): any; type?: string; runOnRender?: boolean; } diff --git a/app/views/RoomView/index.tsx b/app/views/RoomView/index.tsx index f350b8773..260c9c001 100644 --- a/app/views/RoomView/index.tsx +++ b/app/views/RoomView/index.tsx @@ -136,12 +136,18 @@ interface IRoomViewProps { }; } -interface IRoomItem { +export interface IRoomItem { id?: string; - t?: any; - ts?: Date; + t: any; + rid: string; + tmid?: string; + ts: Date; status?: any; u?: { _id: string }; + loaderItem: { + t: string; + ts: Date; + }; } interface INavToThread { @@ -1043,7 +1049,7 @@ class RoomView extends React.Component { return room?.ignored?.includes?.(message?.u?._id) ?? false; }; - onLoadMoreMessages = (loaderItem: any): any => + onLoadMoreMessages = (loaderItem: IRoomItem) => RoomServices.getMoreMessages({ rid: this.rid, tmid: this.tmid, diff --git a/app/views/RoomView/services/getMoreMessages.ts b/app/views/RoomView/services/getMoreMessages.ts index c8e56da77..bda7264ee 100644 --- a/app/views/RoomView/services/getMoreMessages.ts +++ b/app/views/RoomView/services/getMoreMessages.ts @@ -5,8 +5,17 @@ import { } from '../../../constants/messageTypeLoad'; import RocketChat from '../../../lib/rocketchat'; -// TODO - after merge navigation ts -const getMoreMessages = ({ rid, t, tmid, loaderItem }: any) => { +interface IGetMoreMessages { + rid: string; + t?: string; + tmid?: string; + loaderItem: { + t: string; + ts: Date; + }; +} + +const getMoreMessages = ({ rid, t, tmid, loaderItem }: IGetMoreMessages) => { if ([MESSAGE_TYPE_LOAD_MORE, MESSAGE_TYPE_LOAD_PREVIOUS_CHUNK].includes(loaderItem.t)) { return RocketChat.loadMessagesForRoom({ rid,