Room Consumer - React Native
Using RoomConsumer
RoomConsumer is the render-prop form of useRoom(). Use it where you cannot call a hook, such as in a class component.
It takes the same event callbacks as useRoom() as props. Its child is a function that receives the same properties and methods useRoom() returns. To learn more about render props, see the React documentation.
RoomConsumer
import { RoomConsumer } from "@videosdk.live/react-native-sdk";
function RoomScreen() {
return (
<RoomConsumer
onParticipantJoined={(participant) => {
console.log("Joined:", participant.displayName);
}}
// All event callbacks can be passed here
>
{({ roomId, join, leave }) => {
// All properties and methods are available here
return <RoomView roomId={roomId} onJoin={join} onLeave={leave} />;
}}
</RoomConsumer>
);
}
Properties
Methods
Event Callbacks
Got a Question? Ask us on discord

