Const// Host creating and managing polls
import React, { useState } from 'react';
import { PollModal } from 'mediasfu-reactnative-expo';
import { io } from 'socket.io-client';
const socket = io('https://your-server.com');
const [showPolls, setShowPolls] = useState(false);
const activePoll = {
id: 'poll-1',
question: 'What time works best?',
options: ['Morning', 'Afternoon', 'Evening'],
status: 'active',
voters: { 'user1': 0, 'user2': 2 },
votes: [1, 0, 1],
};
return (
<PollModal
isPollModalVisible={showPolls}
onClose={() => setShowPolls(false)}
member="host-user"
islevel="2" // Host - can create/end polls
polls={[activePoll]}
poll={activePoll}
socket={socket}
roomName="meeting-room-123"
handleCreatePoll={handleCreatePoll}
handleEndPoll={handleEndPoll}
handleVotePoll={handleVotePoll}
updateIsPollModalVisible={setShowPolls}
showAlert={showCustomAlert}
/>
);
// Participant voting in polls
return (
<PollModal
isPollModalVisible={isVisible}
onClose={handleClose}
member="participant-user"
islevel="0" // Participant - can only vote
polls={allPolls}
poll={currentPoll}
socket={socketConnection}
roomName={roomId}
handleCreatePoll={handleCreatePoll}
handleEndPoll={handleEndPoll}
handleVotePoll={handleVotePoll}
updateIsPollModalVisible={setIsVisible}
position="center"
backgroundColor="#e8f5e9"
/>
);
PollModal - Interactive polling and voting interface
PollModal is a React Native component that provides a complete polling system for meetings. Hosts/co-hosts can create polls with multiple options, participants can vote, and results are displayed in real-time with vote counts and percentages.
Key Features:
UI Customization: This component can be replaced via
uiOverrides.pollModalto provide a completely custom polling interface.