mediasfu-reactnative-expo
Version:
mediasfu-reactnative-expo – Expo-managed React Native WebRTC SDK for video conferencing, webinars, live streaming, broadcast, screen sharing, whiteboard, chat, recording, live subtitles, translation, and AI agent rooms on iOS, Android, and web. Prebuilt r
142 lines (141 loc) • 4.54 kB
TypeScript
import React from "react";
import { Socket } from "socket.io-client";
import { RespondToWaitingType } from "../../methods/waitingMethods/respondToWaiting";
import { WaitingRoomParticipant } from "../../@types/types";
export interface WaitingRoomModalParameters {
filteredWaitingRoomList: WaitingRoomParticipant[];
/**
* Function to get updated parameters, particularly the filtered waiting room list.
*/
getUpdatedAllParams: () => WaitingRoomModalParameters;
[key: string]: any;
}
export interface WaitingRoomModalOptions {
/**
* Flag to control the visibility of the modal.
*/
isWaitingModalVisible: boolean;
/**
* Callback function to handle the closing of the modal.
*/
onWaitingRoomClose: () => void;
/**
* Initial count of participants in the waiting room.
*/
waitingRoomCounter: number;
/**
* Function to handle changes in the search input.
*/
onWaitingRoomFilterChange: (filter: string) => void;
/**
* List of participants in the waiting room.
*/
waitingRoomList: WaitingRoomParticipant[];
/**
* Function to update the waiting room list.
*/
updateWaitingList: (updatedList: WaitingRoomParticipant[]) => void;
/**
* Name of the room.
*/
roomName: string;
/**
* Socket instance for real-time communication.
*/
socket: Socket;
/**
* Position of the modal on the screen.
* Possible values: 'topLeft', 'topRight', 'bottomLeft', 'bottomRight', 'center'.
* Defaults to 'topRight'.
*/
position?: "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "center";
/**
* Background color of the modal.
* Defaults to '#83c0e9'.
*/
backgroundColor?: string;
/**
* Whether to render the modal body with the modern dark/light theme.
*/
isDarkMode?: boolean;
/**
* Additional parameters for the modal.
*/
parameters: WaitingRoomModalParameters;
/**
* Function to handle participant item press.
* Defaults to respondToWaiting.
*/
onWaitingRoomItemPress?: RespondToWaitingType;
/**
* Optional custom style for the modal container.
*/
style?: object;
/**
* Custom render function for modal content.
*/
renderContent?: (options: {
defaultContent: JSX.Element;
dimensions: {
width: number;
height: number;
};
}) => JSX.Element;
/**
* Custom render function for the modal container.
*/
renderContainer?: (options: {
defaultContainer: JSX.Element;
dimensions: {
width: number;
height: number;
};
}) => React.ReactNode;
}
export type WaitingRoomModalType = (options: WaitingRoomModalOptions) => JSX.Element;
/**
* WaitingRoomModal is a React Native functional component that displays a modal containing a list of participants who are waiting to join a room. Users can filter, accept, or reject participants from the waiting list.
*
* @component
* @param {WaitingRoomModalOptions} props - The properties for the WaitingRoomModal component.
* @returns {JSX.Element} The rendered WaitingRoomModal component.
*
* @example
* ```tsx
* import React from 'react';
* import { WaitingRoomModal } from 'mediasfu-reactnative-expo';
*
* function App() {
* const waitingRoomList = [
* { id: 1, name: 'John Doe' },
* { id: 2, name: 'Jane Smith' },
* ];
*
* const handleWaitingRoomItemPress = ({ participantId, type }) => {
* console.log(`Participant ID ${participantId} was ${type ? 'accepted' : 'rejected'}`);
* };
*
* return (
* <WaitingRoomModal
* isWaitingModalVisible={true}
* onWaitingRoomClose={() => console.log('Modal closed')}
* waitingRoomCounter={waitingRoomList.length}
* onWaitingRoomFilterChange={(filter) => console.log('Filter applied:', filter)}
* waitingRoomList={waitingRoomList}
* updateWaitingList={(updatedList) => console.log('Updated list:', updatedList)}
* roomName="Main Room"
* socket={socketInstance}
* onWaitingRoomItemPress={handleWaitingRoomItemPress}
* backgroundColor="#83c0e9"
* position="topRight"
* parameters={{
* getUpdatedAllParams: () => ({ filteredWaitingRoomList: waitingRoomList }),
* }}
* />
* );
* }
* export default App;
* ```
*/
declare const WaitingRoomModal: React.FC<WaitingRoomModalOptions>;
export default WaitingRoomModal;