-
Notifications
You must be signed in to change notification settings - Fork 334
feat: add text composer and poll composer integration to the message input #3085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
khushal87
wants to merge
106
commits into
V8
Choose a base branch
from
new-text-composer
base: V8
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* feat: remove StreamChatGenerics and introduce interface merging * fix: some of the outstanding todos * chore: add default interfaces * chore: remove SCG from sample app * fix: remove redundant types * fix: remove type module * fix: change the way interface declaration is consumed * fix: ignore ts complaints for interface declaration * chore: migrate TypescriptMessagingApp away from SCG * chore: migrate the Expo sample app away from SCG * fix: commit missing files * fix: revert mistaken change * fix: add resolutions for symlinked libs
BREAKING CHANGE: Release V7
* feat: introduce support for expo-video * fix: remove redundant test * fix: add check for audio component
# Conflicts: # .github/workflows/sample-distribution.yml # package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.ts # package/src/components/ChannelPreview/hooks/useIsChannelMuted.ts # package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts # package/src/hooks/useTranslatedMessage.ts
# Conflicts: # examples/ExpoMessaging/yarn.lock # examples/SampleApp/ios/Podfile.lock # examples/SampleApp/yarn.lock # examples/TypeScriptMessaging/yarn.lock # package/expo-package/yarn.lock # package/native-package/yarn.lock # package/src/components/ChannelList/hooks/listeners/useUserPresence.ts # package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.ts # package/src/hooks/useSelectedChannelState.ts
# Conflicts: # package/expo-package/package.json # package/expo-package/yarn.lock # package/native-package/package.json # package/native-package/yarn.lock # package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx # package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx # package/src/components/Message/Message.tsx # package/src/components/Message/MessageSimple/MessageSimple.tsx # package/src/components/Message/MessageSimple/MessageStatus.tsx # package/src/components/Message/hooks/useMessageActionHandlers.ts # package/src/components/MessageMenu/MessageReactionPicker.tsx # package/src/contexts/messageInputContext/__tests__/pickFile.test.tsx # package/src/contexts/messagesContext/MessagesContext.tsx
SDK Size
|
…ve into new-text-composer
isekovanic
requested changes
May 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks promising as an initial pass, but please have a look at the comments when you have the time. Otherwise, nice !
…to new-text-composer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The primary goal of the PR is to introduce the new message composer and the poll composer integration to the React Native SDK. This is a breaking change for the SDK.
The following are the changes that are done to improve the overall flow/add the message composer, and performance in the SDK:
Emoji
@emoji-mart
to init the data, and the query can be done through thestream-io/react-native-sdk/emoji-middleware
exported from the SDK that can be registered on the text composer middleware. An example can be found on the sample app.Suggestions
stream-chat
package instead of being exported by us.onSelectItem
from the message input context is not needed. They can easily be implemented by the integrators using the text composer. We can mention it in the guide. Integrators can directly calltextComposer.handleSelect
function with the exact item they wanna select as a parameter.openCommandsPicker
andopenMentionsPicker
from the message input context are not needed. They can easily be implemented by the integrators using the text composer. We can mention it in the guide. An example is as follows:ACITriggerSettings
are not needed as we use the composer to get the suggestions for each trigger category.The suggestion context is no longer needed, as we get the suggestion queries and updates through the message composer.
autoCompleteTriggerSettings
andemojiSearchIndex
are gone as part of the suggestions changes. The latter can be easily added in a custom middleware, and the former's customisation can also be incorporated in the middleware.Text input changes
maxMessageLength
,onChangeText
,numberOfLines
,autoCompleteSuggestionsLimit
,closeSuggestions
,mentionAllAppUsersEnabled
,mentionAllAppUsersQuery
,onChange
,openSuggestions
,triggerSettings
,updateSuggestions
,text
,setGiphyActive
,setGiphyEnabled
,giphyEnabled
props are removed from theAutoCompleteInput
component as they can be directly set through theadditionalTextInputProps
or the message composer simplifies the usage so that you don't have to rely on the context anymore which we previously did. Any custom logic for a query can be done by custom middleware.AutoCompleteInput
component now extends React Native'sTextInputProps
for better customizability. This is 10 times better for the future.giphyActive
and thegiphyEnabled
props are gone now from the context and are replaced with a single config propisCommandUIEnabled
that will control whether we want to show the commands UI, which is different from the default text input on the message input.InputGiphySearch
component is now generalised to theCommandInput
component, as it handles other commands, which we never supported. To do this, we have a custom middleware in the SDK that does the job ofcreateCommandInjectionMiddleware
. Note: The logic might move to the LLC very soon once I get some time and I finalise the release.CommandInput
doesn't need thesetShowMoreOptions
anymore.showMoreOptions
andsetShowMoreOptions
are now not a part of the message input context, because this can pretty much be handled locally in the input button without complicating the state in the context.onChange
andappendText
from the message input context are not needed anymore, as the integrators can pretty much customise theAutoCompleteInput
using theadditionalTextInputProps
, and the message composer is available to them wherever they need it if they have a channel.Quoted message
clearQuotedMessageState
,setQuotedMessage
, andquotedMessage
gone away from MessageContext and MessageInputContext as it can be set and received from themessageComposer
easily.Send message
messageComposer.compose()
to compose the message, and the data returned is used to call thesendMessage
in the channel component. This flow will be improved a lot in my next PR involving the attachments manager and handling.Poll Composer
The poll composer is now fully integrated into the create poll content component to manage the composition of the polls. The changes are as follows:
CreatePollContent
are now more granular in nature and divided intoNameField
,MultipleAnswersField
, andCreatePollHeader
components, each with the previous content but just using the poll composer to manage the state and update the fields.pollComposer.updateFields
to update the fields on text changes in text input and on value changes for the switch. The poll options are now more versatile as they respond to the poll ID rather than a numeric index. And after each update, we receive the changes on theonNewOrderSet
function, where we update the field on the composer.messageComposer.createPoll()
and then callsendMessage
, where it will automatically have the poll id through themessageComposer.compose()
method call.Apart from the above generic changes, there are a few code cleanups that have happened, which made sense during the integration.
Quick disclaimer about the PR: The changes will make more sense if you club them with the changes in the later PR - #3093
Also, please ignore the tests failing. The tests have to be reworked entirely usingthe message composer and I plan to do it after my changes for the integration is done as it will be easier then.