You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PollItem.js 817B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // @flow
  2. import React from 'react';
  3. import { View } from 'react-native';
  4. import { useSelector } from 'react-redux';
  5. import { shouldShowResults } from '../../functions';
  6. import { chatStyles } from './styles';
  7. import { PollAnswer, PollResults } from '.';
  8. type Props = {
  9. /**
  10. * Id of the poll
  11. */
  12. pollId: string,
  13. }
  14. const PollItem = ({ pollId }: Props) => {
  15. const showResults = useSelector(state => shouldShowResults(state, pollId));
  16. return (
  17. <View
  18. style = { chatStyles.pollItemContainer }>
  19. { showResults
  20. ? <PollResults
  21. key = { pollId }
  22. pollId = { pollId } />
  23. : <PollAnswer
  24. pollId = { pollId } />
  25. }
  26. </View>
  27. );
  28. };
  29. export default PollItem;