import React from 'react'; import { StyleProp, ViewStyle } from 'react-native'; import { Socket } from 'socket.io-client'; import { RespondToWaitingType } from '../../methods/waitingMethods/respondToWaiting'; import { WaitingRoomParticipant } from '../../@types/types'; /** * Parameters supplied to `WaitingRoomModal` for maintaining filtered state. * * @interface WaitingRoomModalParameters * * **Participant State:** * @property {WaitingRoomParticipant[]} filteredWaitingRoomList Current filtered waiting list snapshot. * * **Utility:** * @property {() => WaitingRoomModalParameters} getUpdatedAllParams Fetches the latest waiting room parameters. * @property {Record} [key: string] Additional shared data available to child components. */ export interface WaitingRoomModalParameters { filteredWaitingRoomList: WaitingRoomParticipant[]; getUpdatedAllParams: () => WaitingRoomModalParameters; [key: string]: any; } /** * Configuration options for the `WaitingRoomModal` component. * * @interface WaitingRoomModalOptions * * **Modal Control:** * @property {boolean} isWaitingModalVisible Controls modal visibility. * @property {() => void} onWaitingRoomClose Invoked when the waiting room modal should close. * * **Queue Management:** * @property {number} waitingRoomCounter Pending participants count displayed in the header badge. * @property {(filter: string) => void} onWaitingRoomFilterChange Callback fired whenever the search input changes. * @property {WaitingRoomParticipant[]} waitingRoomList Complete list of waiting participants. * @property {(updatedList: WaitingRoomParticipant[]) => void} updateWaitingList Persists changes after accept/deny actions. * @property {RespondToWaitingType} [onWaitingRoomItemPress=respondToWaiting] Handler invoked for accept/deny on each participant. * * **Session Context:** * @property {string} roomName Active room identifier used in network calls. * @property {Socket} socket Live socket.io connection powering real-time updates. * * **State Parameters:** * @property {WaitingRoomModalParameters} parameters Parameter bundle supplying filtered state helpers. * * **Customization:** * @property {'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'center'} [position='topRight'] Preferred modal anchor position. * @property {string} [backgroundColor='#83c0e9'] Background color for the modal card. * @property {StyleProp} [style] Additional styles merged into the modal container. * * **Advanced Render Overrides:** * @property {(options: { defaultContent: JSX.Element; dimensions: { width: number; height: number } }) => JSX.Element} [renderContent] * Override that replaces the default modal body content. * @property {(options: { defaultContainer: JSX.Element; dimensions: { width: number; height: number } }) => JSX.Element} [renderContainer] * Override that swaps the default modal container wrapper. */ export interface WaitingRoomModalOptions { isWaitingModalVisible: boolean; onWaitingRoomClose: () => void; waitingRoomCounter: number; onWaitingRoomFilterChange: (filter: string) => void; waitingRoomList: WaitingRoomParticipant[]; updateWaitingList: (updatedList: WaitingRoomParticipant[]) => void; roomName: string; socket: Socket; position?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'center'; backgroundColor?: string; parameters: WaitingRoomModalParameters; onWaitingRoomItemPress?: RespondToWaitingType; 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 WaitingRoomModalType = (options: WaitingRoomModalOptions) => JSX.Element; /** * WaitingRoomModal equips hosts with a moderated queue for admitting participants. It pairs search * filtering with accept/deny actions, leverages socket callbacks for real-time updates, and exposes * render overrides for teams that need bespoke waiting room experiences. * * ### Key Features * - Real-time counter badge that mirrors the filtered waiting list length. * - Search input for quickly locating specific participants. * - Accept/deny actions wired to `respondToWaiting` by default. * - Supports corner anchoring and surface color customization. * - Allows override of both container and internal content via render props. * - Integrates `parameters.getUpdatedAllParams` for up-to-date queue state. * * ### Accessibility * - Close button carries assistive labels for screen readers. * - List items remain accessible thanks to Pressable wrappers within custom renderers. * * @param {WaitingRoomModalOptions} props Modal configuration options. * @returns {JSX.Element} Rendered waiting room management modal. * * @example Basic host usage with default handlers. * ```tsx * ({ filteredWaitingRoomList: filteredList }) * }} * /> * ``` * * @example Custom accept/deny handler and dark theme styling. * ```tsx * ({ filteredWaitingRoomList: filteredPending }) * }} * /> * ``` * * @example Integrating a custom container animation. * ```tsx * ( * {defaultContainer} * )} * /> * ``` */ declare const WaitingRoomModal: React.FC; export default WaitingRoomModal;