Skip to content

Commit ad37c28

Browse files
committed
fix: broken poll voting with react compiler
1 parent ec69f36 commit ad37c28

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

package/src/components/Poll/components/PollOption.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,24 +181,24 @@ export const VoteButton = ({ onPress, option }: PollVoteButtonProps) => {
181181
toggleVote();
182182
}, [message, onPress, poll, toggleVote]);
183183

184+
const hasVote = !!ownVotesByOptionId[option.id];
185+
184186
return ownCapabilities.castPollVote && !isClosed ? (
185187
<Pressable
186188
onPress={onPressHandler}
187189
style={({ pressed }) => [
188190
{ opacity: pressed ? 0.5 : 1 },
189191
styles.voteContainer,
190192
{
191-
backgroundColor: ownVotesByOptionId[option.id]
192-
? voteButtonActive || accent_dark_blue
193-
: 'transparent',
194-
borderColor: ownVotesByOptionId[option.id]
193+
backgroundColor: hasVote ? voteButtonActive || accent_dark_blue : 'transparent',
194+
borderColor: hasVote
195195
? voteButtonActive || accent_dark_blue
196196
: voteButtonInactive || disabled,
197197
},
198198
voteButtonContainer,
199199
]}
200200
>
201-
{ownVotesByOptionId[option.id] ? <Check height={15} pathFill='white' width={20} /> : null}
201+
{hasVote ? <Check height={15} pathFill='white' width={20} /> : null}
202202
</Pressable>
203203
) : null;
204204
};

0 commit comments

Comments
 (0)