[1.3.0] 2020-09-25
BREAKING CHANGES
MessageInput
- Replaced the default image picker react-native-image-picker for react-native-image-crop-picker and added
compressImageQualityprop to support image compression out-of-the-box - Added
FileUploadPreviewandImageUploadPreviewprops to support custom overrides to those components
KeyboardCompatibleView and Channel component
Implementation of internal KeyboardCompatibleView has been changed so as to make animations smoother and fix existing issues with keyboard behavior.
Support for following props have been dropped from Channel and KeyboardCompatibleView
- keyboardDismissAnimationDuration
- keyboardOpenAnimationDuration
Following new props have been introduced on Channel component. They are the same props accepted by KeyboardAvoidingView of react-native.
- keyboardBehavior ['height' | 'position' | 'padding']
- keyboardVerticalOffset
ChannelList
-
We converted the ChannelList component from a class to a function and abstracted the event listener logic into custom hooks. The default event handlers can still be overridden by providing custom prop functions to the ChannelList component. Custom logic can be provided for the following events:
onAddedToChanneloverridesnotification.added_to_channeldefaultonChannelDeletedoverrideschannel.deleteddefaultonChannelHiddenoverrideschannel.hiddendefaultonChannelTruncatedoverrideschannel.truncateddefaultonChannelUpdatedoverrideschannel.updateddefaultonMessageNewoverridesnotification.message_newdefaultonRemovedFromChanneloverridesnotification.removed_from_channeldefault
-
All custom event handlers now accept two arguments, with the
thisreference no longer needed in the functional component.- 1st argument:
setChannelsreference to theuseStatehook that sets thechannelsin the React Native FlatList - 2nd argument:
eventobject returned by the StreamChat instance
- 1st argument:
e.g.,
// In following example we will override the default handler for notification.added_to_channel
<ChannelList
filters={}
onAddedToChannel={(setChannels, event) => {
setChannels(channels => {
// Do additional actions on channels array.
return channels;
})
}}
>- On upgrading to this release, ensure events and any custom handling functions (ex:
onAddedToChanneloronMessageNew) are properly processed and update the list UI as expected.
FileUploadPreview
- We fixed a bug for being unable to remove a file from the
MessageInputand made it consistent toImageUploadPreview - We have removed support for the
fileUploadPreview.dismissTexttheme value - We have added support for
fileUploadPreview.dismiss,fileUploadPreview.dismissImage, andfileUploadPreview.imageContainertheme values
Deprecated Props
-
We have removed support for the
MessageListcomponent'sonMessageTouchprop. Please use theonPressprop on theMessageSimplecomponent to perform an action on touch of a message. -
We have removed support for the
Messagecomponent'sreadOnlyprop. Please use thedisabledvalue from theChannelContextinstead. -
We have also dropped support for the following
MessageListprops:dateSeparator(use DateSeparator instead)headerComponent(use HeaderComponent instead)
this Reference Removal
- We have removed the
thisclass component reference from the prop functions inMessageSimple. For example, if you wish to override the SDK's standard long press behavior on a message, theonLongPressfunction passed in toMessageSimpleno longer takes thethiscomponent reference as it's first argument. The message and the event object become the first and second arguments, respectively.
renderText Function
- The
renderTextfunction utilized in theMessageTextContainercomponent now accepts a single object containingmarkdownRules,markdownStyles, andmessage. Previously each value was a separate function parameter.