PreJoinPage component allows users to either create a new room or join an existing one.

import React from 'react';
import { PreJoinPage } from 'mediasfu-reactnative';
import { JoinLocalRoomOptions } from 'mediasfu-reactnative';

function App() {
* const showAlertFunction = (message: string) => console.log(message);
const updateLoadingFunction = (visible: boolean) => console.log(`Loading: ${visible}`);
const connectSocketFunction = () => {}; // Connect socket function
const updateSocketFunction = (socket: Socket) => {}; // Update socket function
const updateValidatedFunction = (validated: boolean) => {}; // Update validated function
const updateApiUserNameFunction = (userName: string) => {}; // Update API username function
const updateApiTokenFunction = (token: string) => {}; // Update API token function
const updateLinkFunction = (link: string) => {}; // Update link function
const updateRoomNameFunction = (roomName: string) => {}; // Update room name function
const updateMemberFunction = (member: string) => {}; // Update member function

return (
<PreJoinPage
parameters={{
showAlert: showAlertFunction,
updateIsLoadingModalVisible: updateLoadingFunction,
connectSocket: connectSocketFunction,
updateSocket: updateSocketFunction,
updateValidated: updateValidatedFunction,
updateApiUserName: updateApiUserNameFunction,
updateApiToken: updateApiTokenFunction,
updateLink: updateLinkFunction,
updateRoomName: updateRoomNameFunction,
updateMember: updateMemberFunction,
imgSrc: 'https://example.com/logo.png'
}}
credentials={{
apiUserName: 'user123',
apiKey: 'apikey123'
}}
returnUI={true}
noUIPreJoinOptions={{
action: 'create',
capacity: 10,
duration: 15,
eventType: 'broadcast',
userName: 'Prince',
}}
connectMediaSFU={true}
localLink='http://localhost:3000'
/>
);
};


export default App;

Properties

propTypes?: WeakValidationMap<PreJoinPageOptions>

Used to declare the types of the props accepted by the component. These types will be checked during rendering and in development only.

We recommend using TypeScript instead of checking prop types at runtime.

contextTypes?: ValidationMap<any>

Lets you specify which legacy context is consumed by this component.

defaultProps?: Partial<PreJoinPageOptions>

Used to define default values for the props accepted by the component.

type Props = { name?: string }

const MyComponent: FC<Props> = (props) => {
return <div>{props.name}</div>
}

MyComponent.defaultProps = {
name: 'John Doe'
}
displayName?: string

Used in debugging messages. You might want to set it explicitly if you want to display a different name for debugging purposes.


const MyComponent: FC = () => {
return <div>Hello!</div>
}

MyComponent.displayName = 'MyAwesomeComponent'