Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
stream-ci-bot committed Oct 31, 2024
1 parent 3ba68d8 commit cf69253
Show file tree
Hide file tree
Showing 49 changed files with 2,139 additions and 9 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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` |
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>` |
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) |
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 |
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 |
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 |
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 |
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 |
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 }` |
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 docusaurus/docs/reactnative/contexts/create-poll-context.mdx
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 />
10 changes: 10 additions & 0 deletions docusaurus/docs/reactnative/contexts/message-input-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ import UploadImage from '../common-content/contexts/message-input-context/upload
import UpdateMessage from '../common-content/contexts/message-input-context/update_message.mdx';
import UploadNewFile from '../common-content/contexts/message-input-context/upload_new_file.mdx';
import UploadNewImage from '../common-content/contexts/message-input-context/upload_new_image.mdx';
import ClosePollCreationDialog from '../common-content/contexts/message-input-context/close-poll-creation-dialog.mdx';
import ShowPollCreationDialog from '../common-content/contexts/message-input-context/show-poll-creation-dialog.mdx';

`MessageInputContext` is provided by [`Channel`](../../core-components/channel) component. If you are not familiar with React Context API, please read about it on [React docs](https://reactjs.org/docs/context.html).

Expand Down Expand Up @@ -490,3 +492,11 @@ const { sendMessage, toggleAttachmentPicker } = useMessageInputContext();
### <div class="label description">_forwarded from [Channel](../../core-components/channel#uploadprogressindicator)_ props</div> UploadProgressIndicator {#uploadprogressindicator}

<UploadProgressIndicator />

### `closePollCreationDialog`

<ClosePollCreationDialog />

### `showPollCreationDialog`

<ShowPollCreationDialog />
16 changes: 15 additions & 1 deletion docusaurus/docs/reactnative/contexts/messages-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import InitialScrollToFirstUnreadMessage from '../common-content/ui-components/c
import InlineDateSeparator from '../common-content/ui-components/channel/props/inline_date_separator.mdx';
import InlineUnreadIndicator from '../common-content/ui-components/channel/props/inline_unread_indicator.mdx';
import IsAttachmentEqual from '../common-content/ui-components/channel/props/is_attachment_equal.mdx';
import LegacyImageViewerSwipeBehaviour from '../common-content/ui-components/channel/props/legacy_image_viewer_swipe_behaviour.mdx';
import MarkdownRules from '../common-content/ui-components/channel/props/markdown_rules.mdx';
import MessageAvatar from '../common-content/ui-components/channel/props/message-avatar.mdx';
import MessageBounce from '../common-content/ui-components/channel/props/message-bounce.mdx';
Expand Down Expand Up @@ -73,6 +72,9 @@ import TypingIndicator from '../common-content/ui-components/channel/props/typin
import TypingIndicatorContainer from '../common-content/ui-components/channel/props/typing_indicator_container.mdx';
import UrlPreview from '../common-content/ui-components/channel/props/url_preview.mdx';
import VideoThumbnail from '../common-content/ui-components/channel/props/video_thumbnail.mdx';
import OpenPollCreationDialog from '../common-content/ui-components/channel/props/open-poll-creation-dialog.mdx';
import HasCreatePoll from '../common-content/ui-components/channel/props/has-create-poll.mdx';
import PollContent from '../common-content/ui-components/poll/poll-content.mdx';

## Value

Expand Down Expand Up @@ -260,6 +262,14 @@ Upserts a given message in local channel state. Please note that this function d
| ------------------- |
| `(message) => void` |

### <div class="label description">_forwarded from [Channel](../../core-components/channel#openpollcreationdialog)_ props</div> openPollCreationDialog {#openPollCreationDialog}

<OpenPollCreationDialog />

### <div class="label description">_forwarded from [Channel](../../core-components/channel#hascreatepoll)_ props</div> hasCreatePoll {#hascreatepoll}

<HasCreatePoll />

### <div class="label description">_forwarded from [Channel](../../core-components/channel#attachment)_ props</div> Attachment {#attachment}

<Attachment />
Expand Down Expand Up @@ -419,3 +429,7 @@ Upserts a given message in local channel state. Please note that this function d
### <div class="label description">_forwarded from [Channel](../../core-components/channel#videothumbnail)_ props</div> VideoThumbnail {#videoThumbnail}

<VideoThumbnail />

### <div class="label description">_forwarded from [Channel](../../core-components/channel#pollcontent)_ props</div> PollContent {#pollcontent}

<PollContent />
24 changes: 24 additions & 0 deletions docusaurus/docs/reactnative/contexts/own-capabilities-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,27 @@ Ability to upload message attachments.
| Type |
| ------- |
| boolean |

### `sendPoll`

Ability to send polls as messages.

| Type |
| ------- |
| boolean |

### `queryPollVotes`

Ability to query for the votes of polls.

| Type |
| ------- |
| boolean |

### `castPollVote`

Ability to cast a vote on polls.

| Type |
| ------- |
| boolean |
40 changes: 40 additions & 0 deletions docusaurus/docs/reactnative/contexts/poll-context.mdx
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 />
20 changes: 20 additions & 0 deletions docusaurus/docs/reactnative/core-components/channel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ import ThreadList from '../common-content/ui-components/channel/props/thread_lis
import TypingIndicator from '../common-content/ui-components/channel/props/typing_indicator.mdx';
import TypingIndicatorContainer from '../common-content/ui-components/channel/props/typing_indicator_container.mdx';
import UrlPreview from '../common-content/ui-components/channel/props/url_preview.mdx';
import CreatePollContent from '../common-content/contexts/create-poll-context/create-poll-content.mdx';
import OpenPollCreationDialog from '../common-content/ui-components/channel/props/open-poll-creation-dialog.mdx';
import HasCreatePoll from '../common-content/ui-components/channel/props/has-create-poll.mdx';
import PollContent from '../common-content/ui-components/poll/poll-content.mdx';

The `Channel` component is the main entry point for many Stream Chat customizations and contains the majority of the content providers and a significant amount of the logic utilized by Stream Chat for React Native.
Components, custom and out of the box, channel information, and UI integrated chat functions are disseminated by the contexts contained in `Channel`.
Expand Down Expand Up @@ -727,6 +731,14 @@ Callback function to set the [ref](https://reactjs.org/docs/refs-and-the-dom.htm

<ThreadList />

### `openPollCreationDialog`

<OpenPollCreationDialog />

### `hasCreatePoll`

<HasCreatePoll />

<!-- ### updateSuggestions -->

## UI Components Props
Expand Down Expand Up @@ -1028,3 +1040,11 @@ Component to render upload progress indicator as an overlay above [ImageUploadPr
### UrlPreview

<UrlPreview />

### CreatePollContent

<CreatePollContent />

### PollContent

<PollContent />
Loading

0 comments on commit cf69253

Please sign in to comment.