@@ -16,7 +16,7 @@ export type PollResultItemProps<
1616 option : PollOption < StreamChatGenerics > ;
1717} ;
1818
19- export const PollVote = ( vote : PollVoteClass ) => {
19+ export const PollVote = ( { vote } : { vote : PollVoteClass } ) => {
2020 const { t, tDateTimeParser } = useTranslationContext ( ) ;
2121 const { votingVisibility } = usePollState ( ) ;
2222 const {
@@ -47,7 +47,7 @@ export const PollVote = (vote: PollVoteClass) => {
4747 ) ;
4848
4949 return (
50- < View key = { `results_vote_ ${ vote . id } ` } style = { [ styles . voteContainer , container ] } >
50+ < View style = { [ styles . voteContainer , container ] } >
5151 < View style = { { flexDirection : 'row' } } >
5252 { ! isAnonymous && vote . user ?. image ? (
5353 < Avatar image = { vote . user . image as string } key = { vote . id } size = { 20 } />
@@ -61,6 +61,10 @@ export const PollVote = (vote: PollVoteClass) => {
6161 ) ;
6262} ;
6363
64+ const PollResultsVoteItem = ( vote : PollVoteClass ) => (
65+ < PollVote key = { `results_vote_${ vote . id } ` } vote = { vote } />
66+ ) ;
67+
6468export const PollResultsItem = ( { option } : PollResultItemProps ) => {
6569 const { t } = useTranslationContext ( ) ;
6670 const { latestVotesByOption, voteCountsByOption } = usePollState ( ) ;
@@ -86,7 +90,7 @@ export const PollResultsItem = ({ option }: PollResultItemProps) => {
8690 </ View >
8791 { latestVotesByOption ?. [ option . id ] ?. length > 0 ? (
8892 < View style = { { marginTop : 16 } } >
89- { ( latestVotesByOption ?. [ option . id ] ?? [ ] ) . slice ( 0 , 5 ) . map ( PollVote ) }
93+ { ( latestVotesByOption ?. [ option . id ] ?? [ ] ) . slice ( 0 , 5 ) . map ( PollResultsVoteItem ) }
9094 </ View >
9195 ) : null }
9296 < ShowAllVotesButton option = { option } />
0 commit comments