Skip to main content

Document Conversation

Overview

The PDFConversation component displays PDF documents shared within conversations in the LikeMinds chat application. It provides an interface for users to view and interact with PDF files directly in the chat, offering options such as opening, downloading, or previewing the document, enhancing the document-sharing experience within the chat environment.

GitHub File:

LMFeedMediaPreviewScreen

Customisation

The PDFConversation customisations can be done using chatBubbleStyles as shown in the Message component.

Usage Example

  • In your app, create a CustomChatroomScreen file, wrap it with the ChatRoom context provider.
  • Now, you can pass your own custom PDF attachment message component as prop to the ChatRoom context provider
import {
ChatRoom,
ChatroomHeader,
MessageList,
MessageInput,
useChatroomContext,
useMessageListContext,

ChatroomTopic,
STYLES
} from "@likeminds.community/chat-rn-core";
import {InputBoxContextProvider} from '@likeminds.community/chat-rn-core/ChatSX/context/InputBoxContext';
import {ChatroomContextValues} from '@likeminds.community/chat-rn-core/ChatSX/context/ChatroomContext';
import MessageInputBox from "@likeminds.community/chat-rn-core/ChatSX/components/InputBox";

export function CustomChatroomScreen() {

const {
chatroomID,
chatroomWithUser,
currentChatroomTopic,
chatroomType,
replyChatID,
isEditable,
chatroomName,
isSecret,
refInput,
chatroomDBDetails,
chatRequestState,
setIsEditable,
handleFileUpload,
joinSecretChatroom,
onTapToUndo,
}: ChatroomContextValues = useChatroomContext();

return (
<ChatRoom
customPdfAttachmentConversation={<"CUSTOM_PDF_MESSAGE_COMPONENT">}
>

{/* ChatroomHeader */}
<ChatroomHeader />

{/* ChatroomTopic */}
<ChatroomTopic />

{/* MessageList */}
<MessageList />

{/* Input Box Flow */}
<InputBoxContextProvider
chatroomName={chatroomName}
chatroomWithUser={chatroomWithUser}
replyChatID={replyChatID}
chatroomID={chatroomID}
isUploadScreen={false}
myRef={refInput}
handleFileUpload={handleFileUpload}
isEditable={isEditable}
setIsEditable={(value: boolean) => {
setIsEditable(value);
}}
isSecret={isSecret}
chatroomType={chatroomType}
currentChatroomTopic={currentChatroomTopic}
isPrivateMember={chatroomDBDetails.isPrivateMember}
chatRequestState={chatRequestState}>
<MessageInput>
<MessageInputBox />
</MessageInput>
</InputBoxContextProvider>
</ChatRoom>
);
}