@cometchat/chat-uikit-react-native
Version:
Ready-to-use Chat UI Components for React Native
88 lines (87 loc) • 2.15 kB
TypeScript
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-react-native";
/**
* Props for the CometChatCreatePoll component.
*/
export interface CometChatCreatePollInterface {
/**
*
*
* @type {string}
* @description Title of the component
*/
title?: string;
/**
*
*
* @type {string}
* @description Placeholder text for the poll question input
*/
questionPlaceholderText?: string;
/**
*
*
* @type {(error: CometChat.CometChatException) => void}
* @description Callback invoked when an error occurs
*/
onError?: (error: CometChat.CometChatException) => void;
/**
*
*
* @type {CometChat.User}
* @description The user for which the poll is being created
*/
user?: CometChat.User;
/**
*
*
* @type {CometChat.Group}
* @description The group for which the poll is being created
*/
group?: CometChat.Group;
/**
*
*
* @type {() => void}
* @description Callback triggered when the close icon is pressed
*/
onClose?: () => void;
/**
*
*
* @type {string}
* @description Placeholder text for the answer inputs
*/
answerPlaceholderText?: string;
/**
*
*
* @type {string}
* @description Error message when answer fields are empty
*/
answerHelpText?: string;
/**
*
*
* @type {string}
* @description Text for the "Add Answers" button
*/
addAnswerText?: string;
/**
*
*
* @type {number}
* @description Default number of answer options
*/
defaultAnswers?: number;
}
/**
* CometChatCreatePoll component allows the user to create a poll with a question and multiple answers.
*
* It validates the poll inputs, handles keyboard behavior, and makes an API call to create the poll.
*
* @param {CometChatCreatePollInterface} props - The props for the component.
*
* @returns {JSX.Element} The rendered poll creation UI.
*/
export declare const CometChatCreatePoll: (props: CometChatCreatePollInterface) => React.JSX.Element;