Comments (13)
For anyone else arriving here from google like I have wondering what happened to useMessageInput
, it's now useMessageInputContext
from stream-chat-react.
@lr-mjaouen i'm not a 100% sure what you mean. Could you elaborate on this?
from stream-chat-react.
The question is, how can I send an extended message (a custom attachment) using the chat input?
So extending the MessageInput
component and change the handleSubmit
function. Ok.
The problem is when I edit a message, it use the default one and not the extended one, so I have to extend MessageSimple
.
To be able to provide a custom handleSubmit
or a custom attachment shouldn't be a default option?
from stream-chat-react.
How would you like to extend it. We have a prop called overrideSubmitHandler
, this will completely override it, so you can technically implement your own custom attachments etc.
Is that what your looking for?
from stream-chat-react.
3478f2e thx, I will take a look.
@jaapbakker88 is there a way to reuse the channel sendMessage function?
Shouldn't be better to pass all props or the channel to the override function?
In my case I just need to wait for a promise to be resolved before sending it.
from stream-chat-react.
That's definitely an option. Will investigate a way to make this more useful.
from stream-chat-react.
Thanks, a one line addition could be enougth
this.props.overrideSubmitHandler(
{
text,
attachments,
mentioned_users: uniq(this.state.mentioned_users),
parent: this.props.parent,
},
this.props.channel.cid,
this.props
);
Or if you want to keep it private at least the sendMessage function
from stream-chat-react.
(Providing a possible global hook before delete, update & create (send) could be nice I think maybe)
from stream-chat-react.
@lr-mjaouen we now export a useMessageInput hook that lets you use all of the functionality of the MessageInput yourself, more information on that here: https://github.com/GetStream/stream-chat-react/blob/master/src/docs/MessageInputHooks.md
from stream-chat-react.
@jaapbakker88 @lr-mjaouen Is useMessageInput
still available to use? I'm not sure if I can use it.
https://github.com/GetStream/stream-chat-react/blob/master/src/docs/MessageInputHooks.md is not found either.
from stream-chat-react.
Hi @WebPro9369 yes, we still provide this hook: https://github.com/GetStream/stream-chat-react/blob/master/src/docs/useMessageInput.md. Are you getting an error when you're implementing?
from stream-chat-react.
@ambaldwin Thanks for your response.
I think it doesn't get exported in TS version.
from stream-chat-react.
Hi @WebPro9369 , I believe we are exporting it. Check out:
https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/hooks/messageInput.ts
A good example of implementation of this hook is from our example repo and the Team TypeScript app. We are using v.5.2.1 in this app.
https://github.com/GetStream/website-react-examples/blob/master/team-ts/src/components/TeamMessageInput/TeamMessageInput.tsx
Am I missing something? Are you getting an error when trying to implement?
from stream-chat-react.
Related Issues (20)
- Hiding Channels Based on channel type using metadata HOT 2
- Encountering two children with the same key HOT 7
- Unread message notifications do not disappear after reading the message HOT 1
- Unread message notifications do not disappear after reading the message HOT 3
- bug: `unread` on ChannelPreview not updating after muting & unmuting a channel HOT 1
- bug: messageInput autocomplete for emotes (e.g `<3`) sends the message without cleaning the input state HOT 2
- bug: The MessageOptions (triple dot when hovering over a message) requires reverse tabbing for accessibility to select menu items
- bug: Command and Mention popup overlap with play button HOT 1
- bug: channels not marked as `read` on `v11.12.2` unless you receive a message while the channel is open HOT 1
- bug: Setting message_limit less than 25 in ChannelList props disables infinite scroll functionality HOT 2
- bug: numbers follow by a period in a message get rendered as a strange html ordered list HOT 3
- bug: mentions in some scenarios doesn't work HOT 1
- bug: str-chat__message-with-thread-link class is not enabled when the Reply button is shown HOT 1
- bug: StreamChat automatically opens into a conversation on Mobile HOT 4
- Direct Scroll to Specific Message by Channel and Message ID HOT 1
- bug: ChannelInner can call methods on a disconnected channel, causing uncaught errors HOT 3
- bug: invalid SVG urls in dist/css/v2/index.css fails to compile with NextJS dev using Turbopack HOT 2
- bug: mention inside a thread reply doesn't add the mentioned-user to be part of the `thread_participants` HOT 5
- bug: User mention search does not function properly when typing quickly HOT 4
- bug: issue with "renderText" handling line breaks HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stream-chat-react.