-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2743 from GetStream/develop
Next Release
- Loading branch information
Showing
130 changed files
with
5,997 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,10 @@ Async | |
subscribable | ||
memoizing | ||
Boolean | ||
draggable | ||
sendMessage | ||
overridable | ||
loadMore | ||
pollAnswers | ||
enum | ||
SendMessage |
Binary file added
BIN
+126 KB
...urus/docs/reactnative/assets/guides/custom-poll-flow/answer-list-navigation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+962 KB
...cs/reactnative/assets/guides/custom-poll-flow/attachment-picker-poll-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+101 KB
docusaurus/docs/reactnative/assets/guides/custom-poll-flow/custom-answers-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+171 KB
.../docs/reactnative/assets/guides/custom-poll-flow/custom-comments-creation-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+231 KB
.../docs/reactnative/assets/guides/custom-poll-flow/custom-comments-creation-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+170 KB
docusaurus/docs/reactnative/assets/guides/custom-poll-flow/custom-creation-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+240 KB
docusaurus/docs/reactnative/assets/guides/custom-poll-flow/custom-creation-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+239 KB
...urus/docs/reactnative/assets/guides/custom-poll-flow/custom-poll-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+138 KB
...saurus/docs/reactnative/assets/guides/custom-poll-flow/custom-results-title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+134 KB
docusaurus/docs/reactnative/assets/guides/custom-poll-flow/custom-results.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+208 KB
docusaurus/docs/reactnative/assets/guides/custom-poll-flow/custom-step-1-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+576 KB
docusaurus/docs/reactnative/assets/guides/custom-poll-flow/custom-step-1-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+202 KB
docusaurus/docs/reactnative/assets/guides/custom-poll-flow/default-ui-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+176 KB
docusaurus/docs/reactnative/assets/guides/custom-poll-flow/default-ui-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+227 KB
docusaurus/docs/reactnative/assets/guides/custom-poll-flow/default-ui-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+408 KB
docusaurus/docs/reactnative/assets/guides/custom-poll-flow/enable-polls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
...tive/common-content/contexts/create-poll-context/close-poll-creation-dialog.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
A method that will be used as a callback whenever the default `CreatePoll` component back button is pressed in the header. Unless used, it will have no effect if the default `CreatePollContent` is overridden. | ||
|
||
| Type | | ||
| ------------ | | ||
| `() => void` | |
7 changes: 7 additions & 0 deletions
7
...eactnative/common-content/contexts/create-poll-context/create-and-send-poll.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
A method that will be used as a callback whenever send button is clicked on the `CreatePoll` modal. If a custom UI is used for `CreatePollContent`, it can be used as an out-of-the-box method to create and send a poll to the `MessageList`. | ||
|
||
It expects to receive an argument that conforms to the `CreatePollData` type that can be found [here](https://github.com/GetStream/stream-chat-js/blob/master/src/types.ts). | ||
|
||
| Type | | ||
| --------------------------------------------- | | ||
| `(pollData: CreatePollData) => Promise<void>` | |
5 changes: 5 additions & 0 deletions
5
...reactnative/common-content/contexts/create-poll-context/create-poll-content.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
A custom UI component used to render the entire poll creation form. It has access to the [`CreatePollContext`](../../../contexts/create-poll-context.mdx) values by default through the `useCreatePollContext` hook. | ||
|
||
| Type | Default | | ||
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | ||
| ComponentType | [`CreatePollContent`](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Poll/CreatePollContent.tsx) | |
5 changes: 5 additions & 0 deletions
5
...ative/common-content/contexts/create-poll-context/create-poll-option-height.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
A property used to define the height of the poll options in the `CreatePollContent` draggable list. The items can have a constant and equal height only and this should only be used if custom theming implies that the static height of the items changes. Has no effect if a custom UI for `CreatePollContent` is provided. | ||
|
||
| Type | | ||
| ------ | | ||
| number | |
5 changes: 5 additions & 0 deletions
5
...ve/common-content/contexts/message-input-context/close-poll-creation-dialog.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Function called whenever the close button is pressed on the poll creation modal. Has no effect if [`PollCreateContent`](../../../core-components/channel.mdx#createpollcontent) is custom. | ||
|
||
| Type | | ||
| -------- | | ||
| function | |
5 changes: 5 additions & 0 deletions
5
...ive/common-content/contexts/message-input-context/show-poll-creation-dialog.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
A boolean signifying whether the poll creation dialog is shown or not. Will always be `false` if [`PollCreateContent`](../../../core-components/channel.mdx#createpollcontent) is custom. | ||
|
||
| Type | | ||
| ------- | | ||
| boolean | |
13 changes: 13 additions & 0 deletions
13
docusaurus/docs/reactnative/common-content/contexts/poll-context/poll.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
An instance of the [`Poll` class](https://github.com/GetStream/stream-chat-js/blob/master/src/poll.ts) containing reactive state. | ||
|
||
It is used by the underlying `usePollContext`, `usePollStateStore` and `usePollState` hooks to provide us with the reactive `Poll` state. | ||
|
||
:::note | ||
|
||
If you need the `Poll` instance you may get it from `client.polls.fromState(pollId)`. | ||
|
||
::: | ||
|
||
| Type | | ||
| ------ | | ||
| object | |
5 changes: 5 additions & 0 deletions
5
...docs/reactnative/common-content/ui-components/channel/props/has-create-poll.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
A boolean value that is responsible for controlling whether the poll creation button is visible or not. | ||
|
||
| Type | | ||
| ------- | | ||
| boolean | |
11 changes: 11 additions & 0 deletions
11
...native/common-content/ui-components/channel/props/open-poll-creation-dialog.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Function called immediately when the poll creation button is clicked in the attachment picker. Can be used to override the default behaviour of the poll creation UI appearing as a Modal. | ||
|
||
If overridden, a `payload` is passed containing the `sendMessage` callback from [`MessageInputContext`](../../../../contexts/message-input-context.mdx) is passed, so that [`CreatePoll`](../../../../ui-components/create-poll.mdx) | ||
|
||
| Type | | ||
| -------- | | ||
| function | | ||
|
||
| Parameter | Description | | ||
| --------- | ----------------- | | ||
| payload | `{ sendMessage }` | |
25 changes: 25 additions & 0 deletions
25
docusaurus/docs/reactnative/common-content/ui-components/poll/poll-content.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
A `Component` prop used to render the content of the `Poll` component in `MessageList`. | ||
|
||
The component has full access to the entire `Poll` reactive state through the `usePollState` hook. | ||
|
||
| Type | Default | | ||
| ------------- | --------------------------------------------------------------------------------------------------------------------- | | ||
| ComponentType | [`PollContent`](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Poll/Poll.tsx) | | ||
|
||
#### Props | ||
|
||
##### `PollHeader` | ||
|
||
A `Component` prop used to render the header of the `PollContent` component. | ||
|
||
| Type | Default | | ||
| ------------- | -------------------------------------------------------------------------------------------------------------------- | | ||
| ComponentType | [`PollHeader`](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Poll/Poll.tsx) | | ||
|
||
##### `PollButtons` | ||
|
||
A `Component` prop used to render the buttons of the `PollContent` component. | ||
|
||
| Type | Default | | ||
| ------------- | --------------------------------------------------------------------------------------------------------------------- | | ||
| ComponentType | [`PollButtons`](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Poll/Poll.tsx) | |
50 changes: 50 additions & 0 deletions
50
docusaurus/docs/reactnative/contexts/create-poll-context.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
id: create-poll-context | ||
title: CreatePollContext | ||
--- | ||
|
||
import ClosePollCreationDialog from '../common-content/contexts/create-poll-context/close-poll-creation-dialog.mdx'; | ||
import CreateAndSendPoll from '../common-content/contexts/create-poll-context/create-and-send-poll.mdx'; | ||
import CreatePollOptionHeight from '../common-content/contexts/create-poll-context/create-poll-option-height.mdx'; | ||
import SendMessage from '../common-content/contexts/message-input-context/send_message.mdx'; | ||
|
||
The `CreatePollContext` is provided by the [`CreatePoll`](../../ui-components/create-poll) component. If you are not familiar with React Context API, please read about it on [React docs](https://reactjs.org/docs/context.html). | ||
|
||
The `CreatePollContext` needs to be used within the [`Channel` component](../../core-components/channel) as it depends on the [`MessageInputContext`](./message-input-context.mdx) which is added by it. | ||
|
||
## Basic Usage | ||
|
||
The `CreatePollContext` can be consumed by any of the child components of `Channel` as following: | ||
|
||
```tsx | ||
import { useContext } from 'react'; | ||
import { CreatePollContext } from 'stream-chat-react-native'; | ||
|
||
const value = useContext(CreatePollContext); | ||
``` | ||
|
||
Alternatively, you can also use the `useCreatePollContext` hook provided by library to consume `CreatePollContext`. | ||
|
||
```tsx | ||
import { useCreatePollContext } from 'stream-chat-react-native'; | ||
|
||
const value = useCreatePollContext(); | ||
``` | ||
|
||
## Value | ||
|
||
### <div class="label description">_forwarded from [MessageInputContext](../../contexts/message-input-context#sendmessage)_ props</div> sendMessage {#sendmessage} | ||
|
||
<SendMessage /> | ||
|
||
### `closePollCreationDialog` | ||
|
||
<ClosePollCreationDialog /> | ||
|
||
### `createAndSendPoll` | ||
|
||
<CreateAndSendPoll /> | ||
|
||
### `createPollOptionHeight` | ||
|
||
<CreatePollOptionHeight /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
id: poll-context | ||
title: PollContext | ||
--- | ||
|
||
import MessageProp from '../common-content/contexts/message-context/message.mdx'; | ||
import Poll from '../common-content/contexts/poll-context/poll.mdx'; | ||
|
||
The `PollContext` is provided by the [`Poll`](../../ui-components/poll) component. If you are not familiar with React Context API, please read about it on [React docs](https://reactjs.org/docs/context.html). | ||
|
||
The `PollContext` needs to be used within the [`Channel` component](../../core-components/channel) as it depends on various values provided by it in order to work. | ||
|
||
## Basic Usage | ||
|
||
The `PollContext` can be consumed by any of the child components of `Channel` as following: | ||
|
||
```tsx | ||
import { useContext } from 'react'; | ||
import { CreatePollContext } from 'stream-chat-react-native'; | ||
|
||
const value = useContext(PollContext); | ||
``` | ||
|
||
Alternatively, you can also use the `usePollContext` hook provided by library to consume `PollContext`. | ||
|
||
```tsx | ||
import { usePollContext } from 'stream-chat-react-native'; | ||
|
||
const value = usePollContext(); | ||
``` | ||
|
||
## Value | ||
|
||
### <div class="label description">_forwarded from [MessageContext](../../contexts/message-context#message)_ props</div> message {#message} | ||
|
||
<MessageProp /> | ||
|
||
### `poll` \* | ||
|
||
<Poll /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.