Skip to main content

Send DM Request Modal

Overview

The SendDMRequestModal component provides a user interface to confirm sending a Direct Message (DM) request. It is designed to display a confirmation dialog with customizable actions and messages.

LMFeedMediaPreviewScreen

Props

PropertyTypeDescriptionOptional
hideDMSentAlertFunctionFunction to close the modal.
DMSentAlertModalVisiblebooleanControls the visibility of the modal.
onSendFunctionFunction to execute when the confirm button is pressed.
messagestringThe message content to be sent with the DM request.✔️

Features

  1. Confirmation Dialog:

    • Displays a message to confirm the action of sending a DM request.
    • Provides cancel and confirm buttons for user interaction.
  2. Customizable Behavior:

    • Allows passing a custom onSend function to handle the DM request logic.
    • Accepts a custom message to be sent with the request.
  3. User-Friendly Design:

    • Includes descriptive text and buttons for clear navigation.
    • Automatically hides the modal upon confirmation or cancellation.
  4. Transparent Background:

    • The modal has a transparent backdrop to maintain focus on the dialog.

Usage Example

import React from "react";
import { View } from "react-native";
import {
AddFilesView,
AddMoreFilesView,
EditBox,
InputBoxView,
InputWrapper,
InputWrapperLeftSection,
LinkPreviewInputView,
ReplyBoxView,
SelectFilesModal,
SendDMRequestModal,
TextInputWrapper,
useInputBoxContext,
VoiceNoteRecordToast,
UserTaggingList,
RecordSendInputFabView,
} from "@likeminds.community/chat-rn-core";

const CustomMessageInputBox = () => {
const { hideDMSentAlert, message, DMSentAlertModalVisible, onSend } =
useInputBoxContext();

return (
<View>
<VoiceNoteRecordToast />

<InputWrapper>
<InputWrapperLeftSection>
<UserTaggingList />
<ReplyBoxView />
<LinkPreviewInputView />
<EditBox />

<TextInputWrapper>
<AddMoreFilesView />
<InputBoxView />
<AddFilesView />
</TextInputWrapper>
</InputWrapperLeftSection>

<RecordSendInputFabView />
</InputWrapper>

<SelectFilesModal />
{/* Add SendDMRequestModal component like this*/}
<SendDMRequestModal
hideDMSentAlert={hideDMSentAlert}
DMSentAlertModalVisible={DMSentAlertModalVisible}
onSend={onSend}
message={message}
/>
</View>
);
};

export default CustomMessageInputBox;

Customise <SendDMRequestModal /> UI Component

  • Create a new component CustomSendDMRequestModal, referencing the SendDMRequestModal component.
  • Perform your UI customizations in the new component.
import React from "react";
import { View } from "react-native";
import {
AddFilesView,
AddMoreFilesView,
EditBox,
InputBoxView,
InputWrapper,
InputWrapperLeftSection,
LinkPreviewInputView,
ReplyBoxView,
SelectFilesModal,
SendDMRequestModal,
TextInputWrapper,
useInputBoxContext,
VoiceNoteRecordToast,
UserTaggingList,
RecordSendInputFabView,
} from "@likeminds.community/chat-rn-core";
import CustomSendDMRequestModal from "<path_to_custom_send_dm_request_modal_component>";

const CustomMessageInputBox = () => {
const { hideDMSentAlert, message, DMSentAlertModalVisible, onSend } =
useInputBoxContext();

return (
<View>
<VoiceNoteRecordToast />

<InputWrapper>
<InputWrapperLeftSection>
<UserTaggingList />
<ReplyBoxView />
<LinkPreviewInputView />
<EditBox />

<TextInputWrapper>
<AddMoreFilesView />
<InputBoxView />
<AddFilesView />
</TextInputWrapper>
</InputWrapperLeftSection>

<RecordSendInputFabView />
</InputWrapper>

<SelectFilesModal />

{/* Add CustomSendDMRequestModal component like this*/}
<CustomSendDMRequestModal
hideDMSentAlert={hideDMSentAlert}
DMSentAlertModalVisible={DMSentAlertModalVisible}
onSend={onSend}
message={message}
/>
</View>
);
};

export default CustomMessageInputBox;