-
Notifications
You must be signed in to change notification settings - Fork 326
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
question: message.new message text not updated #2931
Comments
Hey @bigint-zz , where does the |
below the whole code of the ChannelScreen view
what I have in my mind is the following one, I send a message "ciao" , the doSendMessageRequest prop crypt the message "ciao" and send it to Stream, but I am not understanding how to show in my ui the text decrypted. I tried with message.new but the ui is not updated |
Where do the messages that are being set are passed? |
in the MessageList |
any news? I tried also another approach below
with the property MessageText, but the problem here is that I triggered 2 times... when I send the message and when I render it |
Hey @bigint-zz , if you want to pass the messages to the MessageList, I would recommend you to wrap that component in your custom component. const decryptMessage = (m: StreamMessage) => ({ ...m, text: 'XXX' + m.text });
const DecryptedMessageList = () => {
const { messages } = useChannelStateContext();
const decryptedMessages = useMemo(() => messages?.map(decryptMessage), [messages]);
return <MessageList messages={decryptedMessages} />;
}; And render:
|
useChannelStateContext(); doesnt exists |
|
i am using React Native, stream-chat-react is not compatible |
Why do you report to stream-chat-react repo? |
you are right, sorry for that I didn't notice it. Do you still have a solution or should I move to the other repo? |
I will transfer this issue to the correct repo. |
up |
Hello @bigint-zz, Which version of the SDK are you currently using ? Our Anyway, back to the task at hand. If you wish to decrypt the messages the best I can advise is to override the That would look something like this:
You can achieve pretty much the same by overriding PS: Thanks @MartinCupela for transferring the issue to our repo ! |
below my package.json
|
That's fine. One thing to point out though, you're using |
thanks for the suggestion. Can you please provide me an example by an override of MessageContent? |
It's the same deal as doing it for
|
I did like that but doesn't work.
|
Please read my comment above, as well as the docs - you're supposed to pass it to the |
I did and I cannot access the text ... do you have any example or share just three rows of codes about using that approach with MessageContent? thanks in advance |
Ah, deepest apologies - it seems I had a lapse in judgement here.
Please make sure that if you do this your |
how can I use useMemo with an asynchronous function? |
You can't do that. I used the In any case, can you please confirm that the initial issue is resolved so that we can close this ticket ? Thanks ! |
can you suggest me the best approach to use for decrypt the message considering that I need to use an asynchronous func? considering I am using ur SDK please help me, about this topic I really didn't find nothing and this issue it will be very useful for other people. |
I am trying to implement the encryption of the chat stream, I successfully encrypt the message on send by using the prop doSendMessageRequest on Channel component, but now I am struggling to decrypt any new message...
I tried different approaches but none works. the following one with the message.new event handler, the setMessages doesn't update the message on the UI
The text was updated successfully, but these errors were encountered: