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.

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;

Properties

propTypes?: WeakValidationMap<WaitingRoomModalOptions>

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<WaitingRoomModalOptions>

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'