Skip to main content

Poll Result Screen

Overview

The PollResult component displays the results of a poll in the LikeMinds chat application, showcasing the poll question, options, and vote counts, along with visual elements to represent vote distribution, providing users with an engaging view of how others have voted.

LMFeedMediaPreviewScreen

UI Components

Data Variables

  • userList: Stores the list of users who have voted in the poll.

Usage Example

  • In your App.tsx, create a Stack.Navigatorin the NavigationContainer wrapped by LMOverlayProvider.
  • Add PollResult as a Stack screen in your NavigationContainer.
App.tsx
import {
POLL_RESULT,
PollResult,
LMOverlayProvider,
STYLES,
} from "@likeminds.community/chat-rn-core";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";

export const App = () => {
const Stack = createNativeStackNavigator();
const pollResultStyles = {
fontColor: "red",
primaryColor: "blue",
fontTypes: {
fontFamilyLight: "Nunito-light",
fontFamilyMedium: "Nunito-medium",
},
};

// poll result screen customisation
if (pollResultStyles) {
STYLES.setTheme(pollResultStyles);
}

return (
<LMOverlayProvider
myClient={myClient} // pass in the LMChatClient created
apiKey={apiKey} // pass in the API Key generated
userName={userName} // pass in the logged-in user's name
userUniqueId={userUniqueID} // pass in the logged-in user's uuid
>
<NavigationContainer ref={navigationRef} independent={true}>
<Stack.Navigator screenOptions={{ headerShown: false }}>
<Stack.Screen
options={{ gestureEnabled: false }}
name={POLL_RESULT}
component={PollResult}
/>
</Stack.Navigator>
</NavigationContainer>
</LMOverlayProvider>
);
};