You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this cookbook we'll go over how we can create and customize a `Channel` screen containing the [`Poll` component](../ui-components/poll.mdx), along with adding navigation to all of its underlying screens rather than relying on modals.
As one final step, let's change the background color of our `Poll`s. Since all `Poll` components are `theme` compatible, we can do this by overriding the default theme:
408
+
Going forward with customizations, let's change the background color of our `Poll`s. Since all `Poll` components are `theme` compatible, we can do this by overriding the default theme:
406
409
407
410
```tsx
408
411
import {
@@ -473,3 +476,244 @@ which gives us a changed `Poll` background:
473
476
:::note
474
477
Make sure that the `theme` is set above your `OverlayProvider` to make sure that the `Poll` customizations are also reflected on the message preview whenever it's long pressed.
475
478
:::
479
+
480
+
As one final step, let's assume we want to add an `PollAnswersList`; however the default UI doesn't fit our requirements and we want something more custom.
481
+
482
+
To do this, we first need to add the `ShowAllCommentsButton` and `AddCommentButton` components to our custom `Buttons` UI:
Next, to actually create comments we need a poll that accepts answers (comments) as well as adding a comment. We can do this by enabling the option when creating a poll and then clicking on the `Add Comment` button:
Now, similar to how we handled the other screens we would want to create a separate `Screen` in the navigation stack for our `AnswersList`. For now, we'll use the default UI:
which will give allow us to navigate to the default `PollAnswersList` UI:
629
+
630
+

631
+
632
+
Now, let's finally customize the UI. To achieve this we can override the `PollAnswersListContent` of our `PollAnswersList`.
633
+
634
+
Since the list of answers can be very large and we want to be able to still display all answers, we will use the `usePollAnswersPagination` hook to get them:
The list will be fully compatible with loading the pagination when scrolling to the bottom and displaying a loading indicator whenever that happens as well.
700
+
701
+
With that, we have finished the customizations we wanted to do for our polls.
702
+
703
+
As a last note; any components that you'd like to reuse from the default UI are free to be imported from within the SDK.
704
+
705
+
An extensive list of these includes:
706
+
707
+
- All buttons mentioned [here](../ui-components/poll-buttons.mdx)
0 commit comments