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: SAMPLES.md
+59-51Lines changed: 59 additions & 51 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Sendbird UIKit for React is a development kit with an user interface that enable
7
7
8
8
### More about Sendbird UIKit for React
9
9
10
-
Find out more about Sendbird UIKit for React at [UIKit for React doc](https://sendbird.com/docs/uikit/v1/javascript/getting-started/about-uikit). If you need any help in resolving any issues or have questions, visit [our community](https://community.sendbird.com).
10
+
Find out more about Sendbird UIKit for React at [UIKit for React doc](https://sendbird.com/docs/uikit/v3/react/overview). If you need any help in resolving any issues or have questions, visit [our community](https://community.sendbird.com).
11
11
12
12
<br />
13
13
@@ -26,32 +26,31 @@ The minimum requirements for UIKit for React are:
26
26
27
27
- React 16.8.0+
28
28
- React DOM 16.8.0+
29
-
-Sendbird Chat SDK for JavaScript 3.0.115+
29
+
-@sendbird/chat v4
30
30
- css-vars-ponyfill 2.3.2
31
31
- date-fns 2.16.1
32
32
33
33
### Implement Chat with App component
34
34
35
-
The `App` component is a collection of all UIKit components you need to implement chat. This is included in all core component samples, so be sure to set your own APP_ID, USER_ID, and NICKNAME in `const.js` in each to customize your sample. On the [CodeSandbox](https://codesandbox.io/s/1-1-using-sendbird-app-9xum5) link, you will see that the props of the `App` component refer to use the values of the correspondings of `const.js` for initialization.
35
+
The `App` component is a collection of all UIKit components you need to implement chat. This is included in all core component samples, so be sure to set your own APP_ID, USER_ID, and NICKNAME in `const.js` in each to customize your sample. On the [CodeSandbox](https://codesandbox.io/s/1-1-using-sendbird-app-9l4d4b) link, you will see that the props of the `App` component refer to use the values of the correspondings of `const.js` for initialization.
36
36
37
37
Try setting your own by downloading the Sendbird sample.
38
38
39
39
```javascript
40
-
import{ AppasSendbirdApp} from'sendbird-uikit'
40
+
importSendbirdAppfrom'@sendbird/uikit-react/App'
41
41
```
42
42
43
43
### Import components to customize UIKit
44
44
45
45
Here is a list of the essential components that you need to import before you start customizing chat. Note that the names of the components are changed as shown in the code below.
46
46
47
-
Try [importing components on CodeSandbox](https://codesandbox.io/s/1-2-customization-basic-format-q4e6c).
47
+
Try [importing components on CodeSandbox](https://codesandbox.io/s/1-2-customization-basic-format-9skqq3).
@@ -70,7 +69,7 @@ This section explains what you need to know before testing the sample app.
70
69
71
70
The **renderChatItem** is a `ReactElement` prop in the Channel component which you can use to customize `message` by setting a function. This prop provides three arguments: **message**, **onUpdateMessage**, and **onDeleteMessage**. The **message** represents an already sent or received message of an `BaseMessage` object; **onUpdateMessage** and **onDeleteMessage** are callback functions which you can implement with custom code for events related to the corresponding user actions.
72
71
73
-
Try your [message item on CodeSandbox](https://codesandbox.io/s/2-1-customizing-messageitem-0nop5?file=).
72
+
Try your [message item on CodeSandbox](https://codesandbox.io/s/2-1-customizing-messageitem-q38cg5).
74
73
75
74
```javascript
76
75
<Channel
@@ -92,29 +91,32 @@ Try your [message item on CodeSandbox](https://codesandbox.io/s/2-1-customizing-
92
91
93
92
The **queries.messageListParams** is an `instance` prop in the **channel** component which you can use to retrieve a list of messages by specifying the properties of `MessageListParams`.
94
93
95
-
Try your [message list params on CodeSandbox](https://codesandbox.io/s/2-2-customizing-messagelistparams-45573).
94
+
Try your [message list params on CodeSandbox](https://codesandbox.io/s/2-2-customizing-messagelistparams-3ipi0g).
96
95
97
96
> Note: On CodeSandbox’s preview, only the messages you sent will be displayed.
98
97
99
98
```javascript
100
99
// Pass arguments in JSON data input format to the query instance.
101
-
<Channel
102
-
queries={{
103
-
messageListParams: {
104
-
senderUserIds: [USER_ID],
105
-
prevResultSize:30,
106
-
includeReplies:false,
107
-
includeReactions:false
108
-
}
109
-
}}
110
-
>
100
+
const [queries] =useState({
101
+
// use object json type input, don't create sendbird query instance
The **onBeforeSendUserMessage**, **onBeforeSendFileMessage**, and **onBeforeUpdateUserMessage** are `callback function` props in the **channel** component. The first two execute additional operations for a user message and a file message respectively; the corresponding modified messages are returned through the **text** and the **file** arguments respectively. The **onBeforeUpdateUserMessage** executes additional operations for a user message before updating it.
116
118
117
-
Try your [message params on CodeSandbox](https://codesandbox.io/s/2-3-customizing-messageparams-phqii)
119
+
Try your [message params on CodeSandbox](https://codesandbox.io/s/2-3-customizing-messageparams-606156)
118
120
119
121
> Note: On the CodeSandbox’s preview, you can send or update a message in highlight.
120
122
@@ -130,23 +132,23 @@ In order to complete an operation you intend to carry out with each function, yo
Find out more about `UserMessageParams` and `FileMessageParams` on the [API reference of Sendbird Chat SDK for JavaScript](https://sendbird.github.io/core-sdk-javascript/module-model_params_userMessageParams-UserMessageParams.html).
141
+
Find out more about `UserMessageParams` and `FileMessageParams` on the [API reference of Sendbird Chat SDK for JavaScript](https://sendbird.com/docs/chat/v4/javascript/ref/interfaces/_sendbird_chat_message.UserMessageCreateParams.html).
140
142
141
143
### Chat header
142
144
143
145
The **renderChatHeader** is a `ReactElement` prop in the **channel** component which you can use to customize the header of `channel` by setting a function. This prop provides two arguments: **channel** and **user**. The channel refers to a `GroupChannel` object which is a collection of properties necessary to render the current channel view. The **user** refers to a `User` object which represents the current user.
144
146
145
-
Try your [chat header on CodeSandbox](https://codesandbox.io/s/2-4-customizing-chatheader-voi0z)
147
+
Try your [chat header on CodeSandbox](https://codesandbox.io/s/2-4-customizing-chatheader-mi5ijz)
146
148
147
149
```javascript
148
150
<Channel
149
-
renderChatHeader={({ channel, user }) => (
151
+
renderChannelHeader={() => (
150
152
<CustomizedHeader />
151
153
)}
152
154
>
@@ -158,12 +160,12 @@ Try your [chat header on CodeSandbox](https://codesandbox.io/s/2-4-customizing-c
158
160
159
161
The **renderMessageInput** is a `ReactElement` prop in the **Channel** component which allows you to customize the message input by setting a function. This prop provides three arguments: **channel**, **user**, and **disabled**. The **channel** refers to a `GroupChannel` object which is a collection of properties necessary to render the current channel view. The **user** refers to a `User` object which represents the current user. The **disabled** refers to whether to enable the message input box or not.
160
162
161
-
Try your [message input on CodeSandbox](https://codesandbox.io/s/2-5-customizing-chatinput-wgi9d)
163
+
Try your [message input on CodeSandbox](https://codesandbox.io/s/2-5-customizing-messageinput-forked-or4lm8)
@@ -175,7 +177,7 @@ Try your [message input on CodeSandbox](https://codesandbox.io/s/2-5-customizing
175
177
176
178
The **renderChannelPreview** is a `ReactElement` prop in the **ChannelList** component which allows you to customize channel preview by setting a function. This prop provides two arguments: **channel** and **onLeaveChannel**. The **channel** refers to a `GroupChannel` object which is a collection of properties necessary to render the current channel view. The **onLeaveChannel** has a callback function as an argument which can be implemented with custom code for events related to the corresponding user action.
177
179
178
-
Try your [channel preview item on CodeSandbox](https://codesandbox.io/s/3-1-customizing-channelpreviewitem-ycsvs)
180
+
Try your [channel preview item on CodeSandbox](https://codesandbox.io/s/3-1-customizing-channelpreviewitem-7c9xz6)
179
181
180
182
```javascript
181
183
<ChannelList
@@ -190,46 +192,52 @@ Try your [channel preview item on CodeSandbox](https://codesandbox.io/s/3-1-cust
190
192
You can make your own customized channel preview item component in this file. You can use the **onLeaveChannel** function in the component.
> Note: You can try making your own customized channel preview item by using `<CustomizedMessageItem />` and using the **onLeaveChannel** function in the component on the CodeSandbox sample.
201
-
202
203
### Channel list query
203
204
204
205
The **queries.channelListQuery** is an `instance` prop in the **ChannelList** component which filters channels by using its options.
205
206
206
-
Try your [channel list query item on CodeSandbox](https://codesandbox.io/s/3-2-customizing-channellistquery-z2y89?file=)
207
+
Try your [channel list query item on CodeSandbox](https://codesandbox.io/s/3-2-customizing-channellistquery-d0t2l8)
207
208
208
209
> Note: On the CodeSandbox’s preview, the empty channels that you see means that the channels are successfully created and there are no messages sent by users.
209
210
210
211
```javascript
211
212
// Pass arguments in JSON data input format to the query instance.
Find out more about `ChannelListQuery` and `ApplicationUserListQuery` on the [API reference of Sendbird Chat SDK for JavaScript](https://sendbird.github.io/core-sdk-javascript/module-model_query_groupChannelListQuery-GroupChannelListQuery.html).
234
+
Find out more about `ChannelListQuery` and `ApplicationUserListQuery` on the [API reference of Sendbird Chat SDK for JavaScript](https://sendbird.com/docs/chat/v4/javascript/ref/classes/_sendbird_chat_groupChannel.GroupChannelListQuery.html).
227
235
228
236
### Channel params
229
237
230
238
The **onBeforeCreateChannel** is a prop of the **ChannelList** component which can be implemented with custom code for events related to the corresponding user actions.
231
239
232
-
Try your [channel param on CodeSandbox](https://codesandbox.io/s/3-3-customizing-channellist-sg9kx)
240
+
Try your [channel param on CodeSandbox](https://codesandbox.io/s/3-3-customizing-channelparams-vgcgtj)
233
241
234
242
> Note: you can create a channel using `GroupChannelParams`.
235
243
@@ -242,7 +250,7 @@ You can get an array of **selectedUsers** in a function argument. In order to co
Find out more about `GroupChannelParams` on the [API reference of Sendbird Chat SDK for JavaScript](https://sendbird.github.io/core-sdk-javascript/module-model_params_groupChannelParams-GroupChannelParams.html).
264
+
Find out more about `GroupChannelParams` on the [API reference of Sendbird Chat SDK for JavaScript](https://sendbird.com/docs/chat/v4/javascript/ref/interfaces/_sendbird_chat_groupChannel.GroupChannelCreateParams.html).
257
265
258
266
## Open Channel Samples
259
267
260
268
We also provide samples for open channels. Check below to see how you can implement and customize open channels.
261
269
262
270
### Live Streaming Sample
263
271
264
-
See how open channel on live stream works on [CodeSandBox](https://codesandbox.io/s/openchannel-1-bvxl9?file=/src/App.js).
272
+
See how open channel on live stream works on [CodeSandBox](https://codesandbox.io/s/openchannel-1-ykexd3).
265
273
266
274
### Community Sample
267
275
268
-
See how you can create community channels on [CodeSandBox](https://codesandbox.io/s/openchannel-2-h7x3b?file=/src/App.js).
276
+
See how you can create community channels on [CodeSandBox](https://codesandbox.io/s/openchannel-2-forked-5kpnqj).
0 commit comments