How to Customize the HeaderView title in the Conversation #131
elliot-choic
announced in
Conversation
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Versions
Summary
This guide explains how to customize the Conversation header title, so you can use your own layout and data.
Guide & Snippet
iOS
How to Customize the HeaderView title in the Conversation
This guide shows how to change the title text of the Conversation Header TitleView.
You can customize the header title of the conversation screen by subclassing
SBAConversationTitleView
and overriding theloadTitle()
method.Step 1: Create a Custom Conversation TitleView Class
Create a subclass of
SBAConversationTitleView
and override theloadTitle()
method:Step 2: Register the Custom ConversationTitleView
Before presenting the conversation view, register your custom header titleView class:
Android
Header
Android
Steps to Customize Conversation Header Title
The following steps show how to replace only the Conversation header title, while keeping the rest of the UI/behavior intact.
1. Create a Custom Conversation Header Component
Extend
ConversationHeaderComponent
and override only what you need.2. Override notifyChannelUpdated to Change the Title
Since the header is redrawn whenever the channel/status updates, override notifyChannelUpdated and replace the title after the default draw.
Why call setTitle inside notifyChannelUpdated?
Because the header is redrawn whenever the channel information (name, status, handoff, etc.) changes.
Overwriting the title after the default update ensures your custom title remains in place.
3. Register the Custom Component with the Provider
When creating the ConversationModule, inject your custom component as headerComponent.
Important: This registration must be done before calling MessengerLauncher.attach() or launching MessengerActivity.
The provider must be ready before the screen is created in order for the custom component to take effect.
JS
Header
// code block
Reference
No response
Screenshots
Beta Was this translation helpful? Give feedback.
All reactions