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.
Props
Property | Type | Description | Optional |
---|---|---|---|
hideDMSentAlert | Function | Function to close the modal. | |
DMSentAlertModalVisible | boolean | Controls the visibility of the modal. | |
onSend | Function | Function to execute when the confirm button is pressed. | |
message | string | The message content to be sent with the DM request. | ✔️ |
Features
Confirmation Dialog:
- Displays a message to confirm the action of sending a DM request.
- Provides cancel and confirm buttons for user interaction.
Customizable Behavior:
- Allows passing a custom
onSend
function to handle the DM request logic. - Accepts a custom message to be sent with the request.
- Allows passing a custom
User-Friendly Design:
- Includes descriptive text and buttons for clear navigation.
- Automatically hides the modal upon confirmation or cancellation.
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 theSendDMRequestModal
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;
- Use the
CustomMessageInputBox
component as a child of theMessageInput
component in the relevant screens: