您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

PollItem.js 801B

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(shouldShowResults(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;