Skip to content

Conversation

@khushal87
Copy link
Member

This pull request introduces a comprehensive refactor of poll-related UI components to improve consistency, accessibility, and maintainability. The changes focus on replacing custom button components with standardized UI buttons, updating styles to use theme primitives, and enhancing the visual presentation of poll options and results. Additionally, a new hook is introduced to determine poll ownership, which is leveraged for dynamic styling.

UI Component Refactoring:

  • Replaced all instances of GenericPollButton in poll components with the standardized Button component, ensuring consistent appearance and behavior across poll actions such as viewing results, ending the vote, suggesting options, and adding comments. [1] [2] [3] [4] [5] [6]
  • Updated poll option rendering to use UserAvatarStack for displaying voters and ProgressBar for vote progress, improving clarity and visual feedback. [1] [2]
  • Refactored PollButtons layout to group buttons in a container with improved spacing and dynamic border colors based on poll ownership.

Styling and Theming Enhancements:

  • Migrated style values to use theme primitives for spacing, typography, and colors, ensuring consistency with the overall app design system. [1] [2] [3]
  • Introduced useStyles hooks in poll components to centralize and memoize style definitions, including dynamic styling based on poll ownership. [1] [2] [3]

New Utility Hook:

  • Added useIsPollCreatedByClient hook to determine if the poll was created by the current user, enabling conditional styling and logic in poll components. [1] [2] [3]

These changes collectively modernize the poll UI, improve maintainability, and enable richer theming and accessibility.

@khushal87 khushal87 requested a review from isekovanic February 11, 2026 06:06
@Stream-SDK-Bot
Copy link
Contributor

Stream-SDK-Bot commented Feb 11, 2026

SDK Size

title develop branch diff status
js_bundle_size 366 KB 366 KB 0 B 🟢

{!isClosed && allowUserSuggestedOptions ? (
<GenericPollButton onPress={onPressHandler} title={t('Suggest an option')} />
<Button
variant='secondary'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using Button everywhere with the same configuration, you can extend GenericPollButton since it already provides all of the necessary properties. At least for the ones that are the same. For the End Vote one you can do it separately

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean use the Button inside GenericPollButton?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Since it's the same everywhere. That's also useful if integrators want to add their own buttons (we provide our default). Otherwise they can do it themselves of course

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

* React hook to check if the poll was created by the logged in client.
* @returns Whether the poll was created by the logged in client.
*/
export const useIsPollCreatedByClient = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const useIsPollCreatedByClient = () => {
export const useIsPollCreatedByCurrentUser = () => {

<View
style={[styles.container, { backgroundColor: emptyColor }]}
onLayout={({ nativeEvent }) => {
setWidth(nativeEvent.layout.width);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can achieve the same by playing with flex, as it was before. You won't need to rely on onLayout, nor on setting state when it happens and consequently rerendering this needlessly.

In other words, let yoga handle it.

Copy link
Contributor

@isekovanic isekovanic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a look at the couple of comments I left here, other than that looks good

@khushal87 khushal87 merged commit 6527a90 into develop Feb 11, 2026
5 checks passed
@khushal87 khushal87 deleted the feat/message-view-poll branch February 11, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants