UNPKG

mediasfu-reactnative

Version:
91 lines (90 loc) 2.55 kB
import React from 'react'; import { Socket } from 'socket.io-client'; import { ConfirmExitOptions } from '../../methods/exitMethods/confirmExit'; /** * Interface defining the options required by the ConfirmExitModal component. */ export interface ConfirmExitModalOptions { /** * Determines if the modal is visible. */ isConfirmExitModalVisible: boolean; /** * Callback function to close the modal. */ onConfirmExitClose: () => void; /** * Position of the modal on the screen. * @default "topRight" */ position?: 'topRight' | 'topLeft' | 'bottomRight' | 'bottomLeft'; /** * Background color of the modal. * @default "#83c0e9" */ backgroundColor?: string; /** * Event handler function to be called on confirming exit. * @default confirmExit */ exitEventOnConfirm?: (options: ConfirmExitOptions) => void; /** * Name of the member exiting. */ member: string; /** * Flag indicating if the member is banned. */ ban?: boolean; /** * Name of the room. */ roomName: string; /** * Socket object for communication. */ socket: Socket; /** * Level of the user (e.g., "1", "2"). */ islevel: string; } export type ConfirmExitModalType = (options: ConfirmExitModalOptions) => JSX.Element; /** * ConfirmExitModal provides a modal interface to confirm user exit or end an event, with the option for admin-level users to end the event for all participants. * * @example * ```tsx * import React, { useState } from 'react'; * import { ConfirmExitModal } from 'mediasfu-reactnative'; * import { io } from 'socket.io-client'; * * const socket = io('https://your-server-url.com'); * * function App() { * const [isModalVisible, setModalVisible] = useState(true); * * return ( * <View> * <Button title="Confirm Exit" onPress={() => setModalVisible(true)} /> * <ConfirmExitModal * isConfirmExitModalVisible={isModalVisible} * onConfirmExitClose={() => setModalVisible(false)} * position="bottomLeft" * backgroundColor="#ffcccc" * exitEventOnConfirm={() => console.log("Exit confirmed")} * member="John Doe" * ban={false} * roomName="MainRoom" * socket={socket} * islevel="2" * /> * </View> * ); * } * * export default App; * ``` */ declare const ConfirmExitModal: React.FC<ConfirmExitModalOptions>; export default ConfirmExitModal;