UNPKG

mediasfu-reactnative

Version:
73 lines (72 loc) 1.99 kB
import React from 'react'; import { Socket } from 'socket.io-client'; import { Request, RespondToRequestsType } from '../../@types/types'; export interface RenderRequestComponentOptions { /** * The request object containing details of the request. */ request: Request; /** * Function to handle the action when a request item is pressed. */ onRequestItemPress: RespondToRequestsType; /** * The list of all requests. */ requestList: Request[]; /** * Function to update the request list. */ updateRequestList: (newRequestList: Request[]) => void; /** * The name of the room. */ roomName: string; /** * The socket instance for real-time communication. */ socket: Socket; } /** * RenderRequestComponent displays a single request item in a list, providing actions to accept or reject the request. * It uses FontAwesome icons to represent different request types. * * @component * @param {RenderRequestComponentOptions} props - The properties for the RenderRequestComponent. * @returns {JSX.Element} The rendered RenderRequestComponent. * * @example * ```tsx * import React from 'react'; * import { RenderRequestComponent } from 'mediasfu-reactnative'; * * const request = { * id: 1, * name: 'Request to share screen', * icon: 'fa-desktop', * }; * * function handleRequestAction(action) { * console.log(`Request ${action}`); * } * * const requestList = [request]; * * function App() { * return ( * <RenderRequestComponent * request={request} * onRequestItemPress={handleRequestAction} * requestList={requestList} * updateRequestList={(newRequestList) => console.log(newRequestList)} * roomName="MainRoom" * socket={socketInstance} * /> * ); * } * * export default App; * ``` */ declare const RenderRequestComponent: React.FC<RenderRequestComponentOptions>; export default RenderRequestComponent;