Skip to content

Commit 31bb945

Browse files
committed
Update docs
1 parent 74ee6b9 commit 31bb945

File tree

6 files changed

+8
-189
lines changed

6 files changed

+8
-189
lines changed

docs/advanced-usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ You can use this URL https://bit.ly/2P0cn2g to test the file message presentatio
6565

6666
:::
6767

68-
On tap, images will be previewed inside an interactive image gallery. To disable the image gallery pass `disableImageGallery` prop to the `Chat` component.
68+
On tap, images will be previewed inside an interactive image gallery. To disable the image gallery pass `disableImageGallery` property to the `Chat` component.
6969

7070
## Files
7171

@@ -142,7 +142,7 @@ export default App
142142

143143
## Link preview
144144

145-
Link preview works automatically, we created a separate library for that, you can found it [here](https://github.com/flyerhq/react-native-link-preview). Usually, however, you'll want to save the preview data so it stays the same, you can do that using `onPreviewDataFetched` callback:
145+
Link preview works automatically, we created a separate package for that, you can found it [here](https://github.com/flyerhq/react-native-link-preview). It can be disabled by setting `usePreviewData` to false. Usually, however, you'll want to save the preview data so it stays the same, you can do that using `onPreviewDataFetched` callback:
146146

147147
```ts
148148
// ...

docs/basic-usage.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ id: basic-usage
33
title: Basic Usage
44
---
55

6-
You start with a `<Chat />` component that will render a chat screen. It has 3 required props:
6+
You start with a `Chat` component that will render a chat. It has 3 required properties:
77

8-
- `messages` - an array of messages to be rendered. Accepts any message, see [types](types). If you have your message types you will need to map those to any of the defined ones. Let us know if we need to add more message types or add more fields to the existing ones.
9-
- `onSendPress` - a function that will have a partial text message as a parameter. See [types](types) for more info on how types are structured. From the partial text message you need to create a text message which will at least have `author`, `id`, `text` and `type: 'text'`, this is done by you because we wanted to give you more control over those values.
10-
- `user` - a [User](types#user) object, that has only one required field - an `id`, used to determine the message author.
8+
* `messages` - an array of messages to be rendered. Accepts any message, see [types](types). If you have your message types you will need to map those to any of the defined ones. Let us know if we need to add more message types or add more fields to the existing ones.
9+
* `onSendPress` - a function that will have a partial text message as a parameter. See [types](types) for more info on how types are structured. From the partial text message you need to create a text message which will at least have `author`, `id`, `text` and `type: 'text'`, this is done by you because we wanted to give you more control over those values.
10+
* `user` - a [User](types#user) object, that has only one required field - an `id`, used to determine the message author.
1111

1212
Below you will find a drop-in example of the chat with only text messages.
1313

1414
:::note
1515

16-
Try to write any URL, for example, flyer.chat, it should be unwrapped in a rich preview.
16+
Try to write any URL, for example, `flyer.chat`, it should be unwrapped in a rich preview.
1717

1818
:::
1919

docs/localization.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,3 @@ You can pass the `locale` prop to the `<Chat />` component. This locale will be
1111
locale='en'
1212
/>
1313
```
14-
15-
## Types
16-
17-
| Name | Type | Description |
18-
|------------------------------------|--------|---------------------------------------------------------------|
19-
| attachmentButtonAccessibilityLabel | string | Accessibility label (hint) for the attachment button |
20-
| emptyChatPlaceholder | string | Placeholder when there are no messages |
21-
| fileButtonAccessibilityLabel | string | Accessibility label (hint) for the tap action on file message |
22-
| inputPlaceholder | string | Placeholder for the text input |
23-
| sendButtonAccessibilityLabel | string | Accessibility label (hint) for the send button |
24-
| today | string | Today string |
25-
| yesterday | string | Yesterday string |

docs/props.md

Lines changed: 0 additions & 51 deletions
This file was deleted.

docs/themes.md

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,3 @@ import { Chat, defaultTheme } from '@flyerhq/react-native-chat-ui'
1717
```
1818

1919
If you created a theme from scratch just pass it to the `theme` prop. We also provide `darkTheme` implementation, you can import it from the library and pass to the `theme` prop.
20-
21-
## Types
22-
23-
:::note
24-
25-
Question mark shows optional types.
26-
27-
:::
28-
29-
| Name | Type | Description |
30-
|---------|-------------------------------|-----------------|
31-
| borders | [ThemeBorders](#themeborders) | Border radiuses |
32-
| colors | [ThemeColors](#themecolors) | Colors |
33-
| fonts | [ThemeFonts](#themefonts) | Text styles |
34-
| icons? | [ThemeIcons](#themeicons) | Icons |
35-
36-
### ThemeBorders
37-
38-
| Name | Type | Description |
39-
|---------------------|--------|------------------------------|
40-
| inputBorderRadius | number | Bottom bar border radius |
41-
| messageBorderRadius | number | Message bubble border radius |
42-
43-
### ThemeColors
44-
45-
| Name | Type | Description |
46-
|-----------------|------------|--------------------------------------------------------------------|
47-
| background | ColorValue | Used as a background color of a chat component |
48-
| error | ColorValue | Color to indicate something bad happened (usually - shades of red) |
49-
| inputBackground | ColorValue | Color of the bottom bar where text input is |
50-
| inputText | ColorValue | Color of the text input's text and attachment/send buttons |
51-
| primary | ColorValue | Primary color of the chat used as a background of sent messages |
52-
| secondary | ColorValue | Secondary color, used as a background of received messages |
53-
54-
### ThemeIcons
55-
56-
| Name | Type | Description |
57-
|-----------------------|---------------------|---------------------------------------|
58-
| attachmentButtonIcon? | ImageSourcePropType | Icon for select attachment button |
59-
| deliveredIcon? | ImageSourcePropType | Icon for message's `delivered` status |
60-
| documentIcon? | ImageSourcePropType | Icon inside file message |
61-
| seenIcon? | ImageSourcePropType | Icon for message's `seen` status |
62-
| sendButtonIcon? | ImageSourcePropType | Icon for send button |

docs/types.md

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,79 +3,4 @@ id: types
33
title: Types
44
---
55

6-
There are 3 supported message types at the moment - `File`, `Image` and `Text`. All of them have corresponding "partial" message types, that include only the message's content. "Partial" messages are useful to create the content and then pass it to some kind of a backend service, which will assign fields like `id` or `author` etc, returning a "full" message which can be passed to `messages` prop of the `<Chat />`. In addition to that, there are `Custom` and `Unsupported` types. `Custom` can be used to build anything you want, and `Unsupported` is just a placeholder to have backwards compatibility.
7-
8-
## Base
9-
10-
All messages should have this, most of these fields will be set by the backend service (you can set `type` and maybe an `error` or `sending` status).
11-
12-
:::note
13-
14-
Question mark shows optional types.
15-
16-
:::
17-
18-
| Name | Type | Description |
19-
| ---------- | -------------------------------------------- | --------------------------------------------------------------- |
20-
| author | [User](#user) | Message's author |
21-
| createdAt? | number | Timestamp in **milliseconds** |
22-
| id | string | Message's ID |
23-
| metadata? | Record<string, any> | Additional custom metadata or attributes related to the message |
24-
| roomId? | string | ID of the room where this message is sent |
25-
| status? | `delivered` `error` `seen` `sending` `sent` | Message's status |
26-
| type | `custom` `file` `image` `text` `unsupported` | Message's type |
27-
28-
## Partial file
29-
30-
| Name | Type | Description |
31-
| --------- | ------ | ------------------------------------------- |
32-
| mimeType? | string | File's MIME type |
33-
| name | string | File's name |
34-
| size | number | Size in **bytes** |
35-
| uri | string | Supports both local resource and remote URL |
36-
37-
### File
38-
39-
File message is a combination of base and partial file types, where the base's `type` is set to `file`. This is what the chat expects in the `messages` array.
40-
41-
## Partial image
42-
43-
Even though `height` and `width` are optional, we recommend setting those (because you will anyway have them from the image picker) for a better overall look and feel, since the placeholder of this size will be rendered and when the image is available it will just replace it.
44-
45-
| Name | Type | Description |
46-
| ------- | ------ | ------------------------------------------- |
47-
| height? | number | Image's height |
48-
| name | string | Image's name |
49-
| size | number | Size in **bytes** |
50-
| uri | string | Supports both local resource and remote URL |
51-
| width? | number | Image's width |
52-
53-
### Image
54-
55-
Image message is a combination of base and partial image types, where the base's `type` is set to `image`. This is what the chat expects in the `messages` array.
56-
57-
## Partial text
58-
59-
| Name | Type | Description |
60-
| ------------ | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
61-
| previewData? | [PreviewData](https://github.com/flyerhq/react-native-link-preview/blob/main/src/types.ts) | You shouldn't probably set this field directly, use `onPreviewDataFetched` callback |
62-
| text | string | Text |
63-
64-
### Text
65-
66-
Text message is a combination of base and partial text types, where the base's `type` is set to `text`. This is what the chat expects in the `messages` array.
67-
68-
## User
69-
70-
The only required field for the user is the `id`, used to determine the message author, however, you can pass additional data if you will want to render all available users for the chat or a conversation tile.
71-
72-
| Name | Type | Description |
73-
| ---------- | ---------------------------------- | ------------------------------------------------------------ |
74-
| createdAt? | number | Created user timestamp, in **milliseconds** |
75-
| firstName? | string | User's first name |
76-
| id | string | Unique ID |
77-
| imageUrl? | string | User's avatar remote URL |
78-
| lastName? | string | User's last name |
79-
| lastSeen? | number | Timestamp when user was last visible, in **milliseconds** |
80-
| metadata? | Record<string, any> | Additional custom metadata or attributes related to the user |
81-
| role? | `admin` `agent` `moderator` `user` | User's role |
6+
There are 3 supported message types at the moment - `File`, `Image` and `Text`. All of them have corresponding "partial" message types, that include only the message's content. "Partial" messages are useful to create the content and then pass it to some kind of a backend service, which will assign fields like `id` or `author` etc, returning a "full" message which can be passed to `messages` prop of the `Chat` component. In addition to that, there are `Custom` and `Unsupported` types. `Custom` can be used to render anything you want, and `Unsupported` is just a placeholder to have backwards compatibility.

0 commit comments

Comments
 (0)