import React from 'react'; import { StyleProp, ViewStyle } from 'react-native'; import { CoHostResponsibility, Participant, ModifyCoHostSettingsOptions, ShowAlert } from '../../@types/types'; import { Socket } from 'socket.io-client'; /** * Options for configuring the `CoHostModal` component. * * @interface CoHostModalOptions * * **Modal Control:** * @property {boolean} isCoHostModalVisible Determines modal visibility. * @property {() => void} onCoHostClose Handler invoked when closing the modal. * @property {(isVisible: boolean) => void} updateIsCoHostModalVisible External setter for visibility. * * **Co-host State:** * @property {string} [currentCohost='No coHost'] Current co-host label. * @property {Participant[]} participants List of available participants. * @property {CoHostResponsibility[]} coHostResponsibility Responsibility matrix for co-host role. * @property {(coHostResponsibility: CoHostResponsibility[]) => void} updateCoHostResponsibility Persists responsibility changes. * @property {(coHost: string) => void} updateCoHost Updates the active co-host value. * * **Session Context:** * @property {string} roomName Current room identifier. * @property {Socket} socket Socket instance for backend updates. * @property {ShowAlert} [showAlert] Optional alert helper. * @property {(settings: ModifyCoHostSettingsOptions) => void} [onModifyEventSettings=modifyCoHostSettings] Callback invoked when saving settings. * * **Appearance:** * @property {'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'} [position='topRight'] Anchor location. * @property {string} [backgroundColor='#83c0e9'] Background color. * @property {StyleProp} [style] Additional styling for the modal container. * * **Advanced Render Overrides:** * @property {(options: { defaultContent: JSX.Element; dimensions: { width: number; height: number } }) => JSX.Element} [renderContent] * Override for the modal content layout. * @property {(options: { defaultContainer: JSX.Element; dimensions: { width: number; height: number } }) => JSX.Element} [renderContainer] * Override for the outer container implementation. */ export interface CoHostModalOptions { isCoHostModalVisible: boolean; currentCohost?: string; participants: Participant[]; coHostResponsibility: CoHostResponsibility[]; position?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'; backgroundColor?: string; roomName: string; showAlert?: ShowAlert; updateCoHostResponsibility: (coHostResponsibility: CoHostResponsibility[]) => void; updateCoHost: (coHost: string) => void; updateIsCoHostModalVisible: (isCoHostModalVisible: boolean) => void; socket: Socket; onCoHostClose: () => void; onModifyEventSettings?: (settings: ModifyCoHostSettingsOptions) => void; style?: StyleProp; renderContent?: (options: { defaultContent: JSX.Element; dimensions: { width: number; height: number; }; }) => JSX.Element; renderContainer?: (options: { defaultContainer: JSX.Element; dimensions: { width: number; height: number; }; }) => JSX.Element; } export type CoHostModalType = (options: CoHostModalOptions) => JSX.Element; /** * CoHostModal assigns and configures co-hosts for an event. It surfaces participant selection, * responsibility toggles, and communicates updates through socket calls, while supporting custom * theming and render overrides. * * ### Key Features * - Presents participant picker excluding admins and current co-host. * - Toggles responsibility and "dedicated" flags with live preview. * - Persists changes via `modifyCoHostSettings` by default. * - Supports render overrides for bespoke layouts and animated containers. * * ### Accessibility * - Switch components include visual and state feedback. * - Close button and save action expose accessibility roles and labels implicitly. * * @param {CoHostModalOptions} props Modal configuration and callbacks. * @returns {JSX.Element} Rendered co-host management modal. * * @example Basic usage with default handlers. * ```tsx * * ``` * * @example Custom content with animated container. * ```tsx * ( * * {defaultContent} * * )} * renderContainer={({ defaultContainer }) => ( * {defaultContainer} * )} * /> * ``` */ declare const CoHostModal: React.FC; export default CoHostModal;