Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

PollItem.js 836B

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 PollAnswer from './PollAnswer';
  7. import PollResults from './PollResults';
  8. import { chatStyles } from './styles';
  9. type Props = {
  10. /**
  11. * Id of the poll.
  12. */
  13. pollId: string,
  14. }
  15. const PollItem = ({ pollId }: Props) => {
  16. const showResults = useSelector(shouldShowResults(pollId));
  17. return (
  18. <View
  19. style = { chatStyles.pollItemContainer }>
  20. { showResults
  21. ? <PollResults
  22. key = { pollId }
  23. pollId = { pollId } />
  24. : <PollAnswer
  25. pollId = { pollId } />
  26. }
  27. </View>
  28. );
  29. };
  30. export default PollItem;