@@ -4,28 +4,14 @@ import { ScrollViewProps, StyleSheet, Text, View } from 'react-native';
44
55import { ScrollView } from 'react-native-gesture-handler' ;
66
7- import { PollOption as PollOptionClass , PollState , PollVote } from 'stream-chat' ;
7+ import { PollOption as PollOptionClass , PollVote } from 'stream-chat' ;
88
99import { VoteButton } from './Button' ;
1010
1111import { PollContextProvider , PollContextValue , useTheme } from '../../../contexts' ;
1212
13- import { DefaultStreamChatGenerics } from '../../../types/types' ;
1413import { Avatar } from '../../Avatar/Avatar' ;
1514import { usePollState } from '../hooks/usePollState' ;
16- import { usePollStateStore } from '../hooks/usePollStateStore' ;
17-
18- type PollOptionSelectorReturnValue = {
19- latest_votes_by_option : Record < string , PollVote [ ] > ;
20- maxVotedOptionIds : string [ ] ;
21- } ;
22-
23- const selector = < StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics > (
24- nextValue : PollState < StreamChatGenerics > ,
25- ) : PollOptionSelectorReturnValue => ( {
26- latest_votes_by_option : nextValue . latest_votes_by_option ,
27- maxVotedOptionIds : nextValue . maxVotedOptionIds ,
28- } ) ;
2915
3016export type PollOptionProps = {
3117 option : PollOptionClass ;
@@ -87,9 +73,8 @@ export const PollAllOptions = ({
8773) ;
8874
8975export const PollOption = ( { option, showProgressBar = true } : PollOptionProps ) => {
90- const { is_closed, vote_counts_by_option } = usePollState ( ) ;
91-
92- const { latest_votes_by_option, maxVotedOptionIds } = usePollStateStore ( selector ) ;
76+ const { is_closed, latest_votes_by_option, maxVotedOptionIds, vote_counts_by_option } =
77+ usePollState ( ) ;
9378
9479 const relevantVotes = useMemo (
9580 ( ) => latest_votes_by_option ?. [ option . id ] ?. slice ( 0 , 2 ) || [ ] ,
0 commit comments