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
Copy file name to clipboardExpand all lines: docusaurus/docs/reactnative/hooks/poll/use-poll-answers-pagination.mdx
+74Lines changed: 74 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,3 +2,77 @@
2
2
id: use-poll-answers-pagination
3
3
title: usePollAnswersPagination
4
4
---
5
+
6
+
A hook that queries answers for a given `Poll` and returns them in a paginated fashion. It can be used whenever we want to view all answers in a given `poll`, like in the [`PollAnswersList` component](../../ui-components/poll-answers-list.mdx) for example.
7
+
8
+
## Properties
9
+
10
+
### `loadFirstPage`
11
+
12
+
A property that depicts whether the hook should load the first page of answers when first invoked or not. Default to `true` if omitted.
13
+
14
+
| Type |
15
+
| ------ |
16
+
|`boolean`|
17
+
18
+
### `paginationParams`
19
+
20
+
An object containing the pagination parameters that we may want to pass to the hook that will then be used to query for answers.
21
+
22
+
Its type can be found [here](https://github.com/GetStream/stream-chat-js/blob/master/src/types.ts) under the name `PollAnswersQueryParams`.
23
+
24
+
| Type |
25
+
| ------ |
26
+
|`object`|
27
+
28
+
## Return type
29
+
30
+
The `usePollAnswersPagination` hook returns an object containing pagination values for the `poll`'s answers.
31
+
32
+
### error
33
+
34
+
An object containing an error if one is thrown during querying for the answers.
35
+
36
+
| Type |
37
+
| ------ |
38
+
|`object`|
39
+
40
+
### hasNextPage
41
+
42
+
A property depicting whether the list of answers has a next page to load or not.
43
+
44
+
| Type |
45
+
| ------ |
46
+
|`boolean`|
47
+
48
+
### loading
49
+
50
+
A property depicting whether the next page of answers is currently loading or not.
51
+
52
+
| Type |
53
+
| ------ |
54
+
|`boolean`|
55
+
56
+
### loadMore
57
+
58
+
A function that loads the next page of answers whenever invoked. It will automatically update [`pollAnswers`](#pollanswers)
59
+
60
+
| Type |
61
+
| ------ |
62
+
|`() => void`|
63
+
64
+
### next
65
+
66
+
A reference to the next cursor in the pagination.
67
+
68
+
| Type |
69
+
| ------ |
70
+
|`string`|
71
+
72
+
### pollAnswers
73
+
74
+
A list of answers that has been loaded so far. It automatically updates itself whenever `loadMore()` is invoked and triggers a `state` update.
Copy file name to clipboardExpand all lines: docusaurus/docs/reactnative/hooks/poll/use-poll-option-votes-pagination.mdx
+85Lines changed: 85 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,3 +2,88 @@
2
2
id: use-poll-option-votes-pagination
3
3
title: usePollOptionVotesPagination
4
4
---
5
+
6
+
A hook that queries votes for a given option in a `Poll` and returns them in a paginated fashion. It can be used whenever we want to view all votes in a given `poll`, like in the [`PollOptionFullResults` component](../../ui-components/poll-option-full-results.mdx) for example.
7
+
8
+
## Properties
9
+
10
+
### `loadFirstPage`
11
+
12
+
A property that depicts whether the hook should load the first page of answers when first invoked or not. Default to `true` if omitted.
13
+
14
+
| Type |
15
+
| ------ |
16
+
|`boolean`|
17
+
18
+
### `option` *
19
+
20
+
The `poll` option that we want to query the votes for.
21
+
22
+
| Type |
23
+
| ------ |
24
+
|`object`|
25
+
26
+
### `paginationParams`
27
+
28
+
An object containing the pagination parameters that we may want to pass to the hook that will then be used to query for votes.
29
+
30
+
Its type can be found [here](https://github.com/GetStream/stream-chat-js/blob/master/src/types.ts) under the name `PollOptionVotesQueryParams`.
31
+
32
+
The `{ option_id: <option-id> }` filter is mandatory and will be added regardless of overrides.
33
+
34
+
| Type |
35
+
| ------ |
36
+
|`object`|
37
+
38
+
## Return type
39
+
40
+
The `usePollOptionVotesPagination` hook returns an object containing pagination values for the `poll` option's votes.
41
+
42
+
### error
43
+
44
+
An object containing an error if one is thrown during querying for the votes.
45
+
46
+
| Type |
47
+
| ------ |
48
+
|`object`|
49
+
50
+
### hasNextPage
51
+
52
+
A property depicting whether the list of votes has a next page to load or not.
53
+
54
+
| Type |
55
+
| ------ |
56
+
|`boolean`|
57
+
58
+
### loading
59
+
60
+
A property depicting whether the next page of votes is currently loading or not.
61
+
62
+
| Type |
63
+
| ------ |
64
+
|`boolean`|
65
+
66
+
### loadMore
67
+
68
+
A function that loads the next page of votes whenever invoked. It will automatically update [`votes`](#votes)
69
+
70
+
| Type |
71
+
| ------ |
72
+
|`() => void`|
73
+
74
+
### next
75
+
76
+
A reference to the next cursor in the pagination.
77
+
78
+
| Type |
79
+
| ------ |
80
+
|`string`|
81
+
82
+
### vote
83
+
84
+
A list of votes that has been loaded so far. It automatically updates itself whenever `loadMore()` is invoked and triggers a `state` update.
Copy file name to clipboardExpand all lines: docusaurus/docs/reactnative/hooks/poll/use-poll-state.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ This hook can only be used within a child of [`PollContext`](../../contexts/poll
11
11
12
12
It is highly recommended that the user familiarizes themselves with the [`Poll` client documentation](https://getstream.io/chat/docs/javascript/polls_api/?language=javascript&q=poll) in order to understand the properties better.
13
13
14
-
## Return value
14
+
## Return type
15
15
16
16
The `usePollState` hook returns an object containing values from the `PollState`.
0 commit comments