Skip to content

Commit 1d5dbf3

Browse files
authored
fix: Change type of react elements (#275)
* Change every `React.ReactNode` and `React.Component` to `React.ReactElement` * Use the type of SendbirdError * Use the type MessageSearchQueryParams * Use enum MessageSearchOrder.TIMESTAMP in the message search query params instead of `'ts' as const` **ReactNode** could be `string | number | null | undefined | ReactElement | portal` and this(expecting string or number) causes **warning** when we use it like `<CustomComp />` ```typescript // in the component { renderMessage } = props const CustomMessage = useMemo(() => { return renderMessage({ ... }); }, []); return ( <div> <CustomMessage /> </div> ); ``` so expecting **ReactElement** is better for our case
1 parent 72dcb49 commit 1d5dbf3

File tree

27 files changed

+223
-223
lines changed

27 files changed

+223
-223
lines changed

CHANGELOG_v2.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ channel OpenChannelSettings
294294
- Features/Bugs:
295295
* ChannelList
296296
* disableUserProfile: boolean
297-
* renderUserProfile: React.Component
297+
* renderUserProfile: React.ReactElement
298298

299299
## 1.2.4(Sept 17, 2020) Deprecated
300300

@@ -304,16 +304,16 @@ channel OpenChannelSettings
304304

305305
* SendBirdProvider
306306
* disableUserProfile: boolean
307-
* renderUserProfile: React.Component
307+
* renderUserProfile: React.ReactElement
308308
* allowProfileEdit: boolean
309309
* Channel
310310
* disableUserProfile: boolean
311-
* renderUserProfile: React.Component
311+
* renderUserProfile: React.ReactElement
312312
* ChannelSettings
313313
* disableUserProfile: boolean
314-
* renderUserProfile: React.Component
314+
* renderUserProfile: React.ReactElement
315315
* ChannelList
316-
* renderHeader(): React.Component
316+
* renderHeader(): React.ReactElement
317317
* allowProfileEdit: boolean
318318
* onThemeChange(theme: string): void
319319
* onProfileEditSuccess(user: User): void

MIGRATION_v2-to-v3.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,9 @@ The following table lists properties that were added to the `ChannelList` module
481481

482482
|Property name|Type|Description|
483483
|---|---|---|
484-
|renderPlaceHolderError|ReactElement|Renders a customized placeholder for error messages in the channel list. (Default: `null`)|
485-
|renderPlaceHolderLoading|ReactElement|Renders a customized placeholder for loading messages in the channel list. (Default: `null`)|
486-
|renderPlaceHolderEmptyList|ReactElement|Renders a customized placeholder message for when the channel list is empty. (Default: `null`)|
484+
|renderPlaceHolderError|React.ReactElement|Renders a customized placeholder for error messages in the channel list. (Default: `null`)|
485+
|renderPlaceHolderLoading|React.ReactElement|Renders a customized placeholder for loading messages in the channel list. (Default: `null`)|
486+
|renderPlaceHolderEmptyList|React.ReactElement|Renders a customized placeholder message for when the channel list is empty. (Default: `null`)|
487487

488488
</div>
489489

@@ -605,8 +605,8 @@ const MyFileMessageComponent = ({ message, chainTop, chainBottom }) => {
605605

606606
|Render prop|From v2|To v3|
607607
|---|---|---|
608-
|renderMessageInput|({ channel, user, disabled, quoteMessage }) => React.ReactNode|() => React.ReactNode|
609-
|renderChannelHeader|renderChatHeader?: ({ channel, user }) => React.ReactNode|renderChannelHeader?: () => React.ReactNode|
608+
|renderMessageInput|({ channel, user, disabled, quoteMessage }) => React.ReactElement|() => React.ReactElement|
609+
|renderChannelHeader|renderChatHeader?: ({ channel, user }) => React.ReactElement|renderChannelHeader?: () => React.ReactElement|
610610

611611
</div>
612612

@@ -659,14 +659,14 @@ The following table lists properties that were added to the `Channel` module.
659659
660660
|Property name|Type|Description|
661661
|---|---|---|
662-
|renderPlaceholderLoader|ReactElement|Renders a customized placeholder for loading messages in the channel. (Default: `null`)|
663-
|renderPlaceholderInvalid|ReactElement|Renders a customized placeholder for invalid channel state. (Default: `null`)|
664-
|renderPlaceholderEmpty|ReactElement|Renders a customized placeholder for an empty channel. (Default: `null`)|
665-
|renderChannelHeader|ReactElement|Renders a customized channel header component. (Default: `null`)|
666-
|renderMessage|ReactElement|Renders a customized message view in the channel. (Default: `null`)|
667-
|renderMessageInput|ReactElement|Renders a customized message input component. (Default: `null`)|
668-
|renderTypingIndicator|ReactElement|Renders a customized typing indicator component. (Default: `null`)|
669-
|renderCustomSeperator|ReactElement|Renders a customized date separator view in the message list component. (Default: `null`)|
662+
|renderPlaceholderLoader|React.ReactElement|Renders a customized placeholder for loading messages in the channel. (Default: `null`)|
663+
|renderPlaceholderInvalid|React.ReactElement|Renders a customized placeholder for invalid channel state. (Default: `null`)|
664+
|renderPlaceholderEmpty|React.ReactElement|Renders a customized placeholder for an empty channel. (Default: `null`)|
665+
|renderChannelHeader|React.ReactElement|Renders a customized channel header component. (Default: `null`)|
666+
|renderMessage|React.ReactElement|Renders a customized message view in the channel. (Default: `null`)|
667+
|renderMessageInput|React.ReactElement|Renders a customized message input component. (Default: `null`)|
668+
|renderTypingIndicator|React.ReactElement|Renders a customized typing indicator component. (Default: `null`)|
669+
|renderCustomSeperator|React.ReactElement|Renders a customized date separator view in the message list component. (Default: `null`)|
670670
671671
</div>
672672
@@ -698,7 +698,7 @@ import { ChannelSettings } from "@sendbird/uikit-react"
698698
699699
|Render prop|From v2|To v3|
700700
|---|---|---|
701-
|renderChannelProfile|({ channel }) => React.ReactNode|() => React.ReactNode|
701+
|renderChannelProfile|({ channel }) => React.ReactElement|() => React.ReactElement|
702702
703703
</div>
704704
@@ -724,9 +724,9 @@ The following table lists properties that were added to the `ChannelSettings` mo
724724
725725
|Property name|Type|Description|
726726
|---|---|---|
727-
|renderPlaceHolderError|ReactElement|Renders a customized placeholder for error messages that occur in the channel settings menu. (Default: `null`)|
728-
|renderModerationPanel|ReactElement|Renders a customized view of the moderation panel that displays the moderation tools for channel operators. (Default: `null`)|
729-
|renderexitChannel|ReactElement|Renders a customized leave channel button in the settings module. (Default: `null`)|
727+
|renderPlaceHolderError|React.ReactElement|Renders a customized placeholder for error messages that occur in the channel settings menu. (Default: `null`)|
728+
|renderModerationPanel|React.ReactElement|Renders a customized view of the moderation panel that displays the moderation tools for channel operators. (Default: `null`)|
729+
|renderexitChannel|React.ReactElement|Renders a customized leave channel button in the settings module. (Default: `null`)|
730730
731731
</div>
732732
@@ -758,8 +758,8 @@ import { OpenChannel } from "@sendbird/uikit-react"
758758
759759
|Render prop|From v2|To v3|
760760
|---|---|---|
761-
|renderChannelTitle|({channel, user}) => React.ReactNode|() => React.ReactNode|
762-
|renderMessageInput|({channel, user, disabled}) => React.ReactNode|() => React.ReactNode|
761+
|renderChannelTitle|({channel, user}) => React.ReactElement|() => React.ReactElement|
762+
|renderMessageInput|({channel, user, disabled}) => React.ReactElement|() => React.ReactElement|
763763
764764
</div>
765765
@@ -806,12 +806,12 @@ The following table lists properties that were added to the `OpenChannel` module
806806
807807
|Property name|Type|Description|
808808
|---|---|---|
809-
|renderMessage|ReactElement|Renders a customized message view in the channel. (Default: `null`)|
810-
|renderHeader|ReactElement|Renders a customized channel header component. (Default: `null`)|
811-
|renderInput|ReactElement|Renders a customized message input component. (Default: `null`)|
812-
|renderPlaceholderEmptyList|ReactElement|Renders a customized placeholder for an empty channel. (Default: `null`)|
813-
|renderPlaceHolderError|ReactElement|Renders a customized placeholder for error messages that occur in the channel. (Default: `null`)|
814-
|renderPlaceholderLoading|ReactElement|Renders a customized placeholder for loading messages in the channel. (Default: `null`)|
809+
|renderMessage|React.ReactElement|Renders a customized message view in the channel. (Default: `null`)|
810+
|renderHeader|React.ReactElement|Renders a customized channel header component. (Default: `null`)|
811+
|renderInput|React.ReactElement|Renders a customized message input component. (Default: `null`)|
812+
|renderPlaceholderEmptyList|React.ReactElement|Renders a customized placeholder for an empty channel. (Default: `null`)|
813+
|renderPlaceHolderError|React.ReactElement|Renders a customized placeholder for error messages that occur in the channel. (Default: `null`)|
814+
|renderPlaceholderLoading|React.ReactElement|Renders a customized placeholder for loading messages in the channel. (Default: `null`)|
815815
816816
</div>
817817
@@ -855,8 +855,8 @@ The following table lists properties that were added to the `OpenChannelSettings
855855
856856
|Property name|Type|Description|
857857
|---|---|---|
858-
|renderOperatorUI|ReactElement|Renders a customized view of the channel settings for operators. (Default: `null`)|
859-
|renderParticipantList|ReactElement|Renders a customized view of the channel settings for non-operator members. (Default: `null`)|
858+
|renderOperatorUI|React.ReactElement|Renders a customized view of the channel settings for operators. (Default: `null`)|
859+
|renderParticipantList|React.ReactElement|Renders a customized view of the channel settings for non-operator members. (Default: `null`)|
860860
861861
</div>
862862
@@ -890,10 +890,10 @@ The following table lists properties that were added to the `MessageSearch` modu
890890
891891
|Property name|Type|Description|
892892
|---|---|---|
893-
|renderPlaceHolderError|ReactElement|Renders a customized placeholder for error messages that occur in the search result. (Default: `null`)|
894-
|renderPlaceholderLoading|ReactElement|Renders a customized placeholder for loading messages in the search result. (Default: `null`)|
895-
|renderPlaceHolderNoString|ReactElement|Renders a customized placeholder for when there are no messages that match the search query.|
896-
|renderPlaceholderEmptyList|ReactElement|Renders a customized placeholder for an empty list of search results. (Default: `null`)|
893+
|renderPlaceHolderError|React.ReactElement|Renders a customized placeholder for error messages that occur in the search result. (Default: `null`)|
894+
|renderPlaceholderLoading|React.ReactElement|Renders a customized placeholder for loading messages in the search result. (Default: `null`)|
895+
|renderPlaceHolderNoString|React.ReactElement|Renders a customized placeholder for when there are no messages that match the search query.|
896+
|renderPlaceholderEmptyList|React.ReactElement|Renders a customized placeholder for an empty list of search results. (Default: `null`)|
897897
898898
</div>
899899

0 commit comments

Comments
 (0)