highlightedMessage

[Problem/Question]

highlightedMessage on Channel component


[UIKit Version]
^3.6.8

Hello,

I have a question, regarding the highlightedMessage prop for Channel component in ReactUI kit.
Does it only highlight the message, or should it also scroll to the highlighted message?
I am pretty sure it used to scroll to the message being highlighted, but now it seems not to. Was there a recent change, regarding this behaviour?

Hello @temp-acc

The highlightedMessage prop in the Channel component of the React UI kit is used to highlight a specific message in the channel. However, it does not automatically scroll to the highlighted message. If you want to scroll to the highlighted message, you will need to implement the scrolling logic yourself.

Let me know if my understanding of the reported issue is correct. If not then can you please elaborate more so that I can check and assist you accordingly?

Hello,

thanks for the clarification it was sufficient.

however, I am trying to implement the scrolling behaviour now, and I’m running into some issues.

The first one is that document.querySelector is not suitable for this, because the message is not in the DOM on first render, and the component does not get rerendered when the dom changes, so this does not work:

Furthermore, I tried to implement it with the scrollToMessage function, provided by useChannelContext(),
but I cannot understand why does it need, and where to get the createdAt property in addition to messageId. ( should’nt the messageId be a unique identifier, and enough on it’s own, to find the required message? ):
image

Thank you for your time.