getstream-iomentiongetstream-chat

Is there a way to handle press action on mentions with react native getstream sdk


Hi there problem solvers :)

I am trying to redirect to the user profile that has been mentioned on message bubble, on mention press.

I explored the getstream docs for react native but did not find anything related to this issue.


Solution

  • You can do it as following:

    <Channel
      channel={channel}
      onPressMessage={({ message, emitter, additionalInfo }) => {
        if (emitter === 'textMention') {
          // custom implementation navigating to user profile
          // additionalInfo.user corresponds to mentioned user object, which is pressed
          goToUserProfile(additionalInfo.user.id);
        }
      })}
    >
      <MessageList />
      <MessageInput />
    </Channel>