UNPKG

mediasfu-reactnative

Version:
103 lines (102 loc) 3.12 kB
import React from 'react'; import { Socket } from 'socket.io-client'; import { ConnectSocketType } from '../../sockets/SocketManager'; import { ShowAlert } from '../../@types/types'; /** * Interface defining the parameters for the WelcomePage component. */ export interface WelcomePageParameters { /** * Source URL for the logo image. * Defaults to 'https://mediasfu.com/images/logo192.png' if not provided. */ imgSrc?: string; /** * Function to display alert messages. */ showAlert?: ShowAlert; /** * Function to toggle the visibility of the loading modal. */ updateIsLoadingModalVisible: (visible: boolean) => void; /** * Function to establish a socket connection. */ connectSocket: ConnectSocketType; /** * Function to update the socket instance in the parent state. */ updateSocket: (socket: Socket) => void; /** * Function to update the validation state in the parent. */ updateValidated: (validated: boolean) => void; /** * Function to update the API username in the parent state. */ updateApiUserName: (apiUserName: string) => void; /** * Function to update the API token in the parent state. */ updateApiToken: (apiToken: string) => void; /** * Function to update the event link in the parent state. */ updateLink: (link: string) => void; /** * Function to update the room name in the parent state. */ updateRoomName: (roomName: string) => void; /** * Function to update the member name in the parent state. */ updateMember: (userName: string) => void; } /** * Interface defining the props for the WelcomePage component. */ export interface WelcomePageOptions { /** * Parameters required by the WelcomePage component. */ parameters: WelcomePageParameters; } export type WelcomePageType = (options: WelcomePageOptions) => JSX.Element; /** * WelcomePage component allows users to enter event details manually or by scanning a QR code. * It validates the input and attempts to connect to a socket with the provided credentials. * * @component * @param {WelcomePageOptions} props - The properties for the WelcomePage component. * @returns {JSX.Element} The rendered WelcomePage component. * * @example * ```tsx * import React from 'react'; * import { WelcomePage } from 'mediasfu-reactnative'; * * function App() { * const parameters = { * imgSrc: 'https://example.com/logo.png', * showAlert: alertFunction, * updateIsLoadingModalVisible: toggleLoadingModal, * connectSocket: connectToSocket, * updateSocket: setSocket, * updateValidated: setValidated, * updateApiUserName: setApiUserName, * updateApiToken: setApiToken, * updateLink: setEventLink, * updateRoomName: setRoomName, * updateMember: setUserName, * }; * * return ( * <WelcomePage parameters={parameters} /> * ); * } * * export default App; * ``` */ declare const WelcomePage: React.FC<WelcomePageOptions>; export default WelcomePage;