CoHostModal component allows users to manage co-host settings in a virtual event.

This component renders a modal interface where users can assign a new co-host from the list of participants, set responsibilities, and save the updated settings. It leverages a Socket instance for real-time updates and offers customizable modal position and styling options.

import React from 'react';
import { CoHostModal } from 'mediasfu-reactnative-expo';
import { io } from 'socket.io-client';

function App() {
const socket = io('http://localhost:3000');

return (
<CoHostModal
isCoHostModalVisible={true}
onCoHostClose={() => console.log('Modal closed')}
currentCohost="John Doe"
participants={[
{ name: 'John Doe', islevel: '1' },
{ name: 'Jane Doe', islevel: '0' }
]}
coHostResponsibility={[
{ name: 'manageParticipants', value: true, dedicated: false }
]}
position="topRight"
backgroundColor="#83c0e9"
roomName="Room 1"
showAlert={({ message, type }) => console.log(message, type)}
updateCoHostResponsibility={(responsibilities) => console.log(responsibilities)}
updateCoHost={(coHost) => console.log(coHost)}
updateIsCoHostModalVisible={(visible) => console.log(visible)}
socket={socket}
/>
);
}

export default App;

Properties

propTypes?: WeakValidationMap<CoHostModalOptions>

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

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'