Repository navigation
docs(react-native): register the text formatter on the thread header too - #548
suraj-chauhan-cometchat wants to merge 2 commits into
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Step 4 listed five surfaces and said the rest inherit the formatter. The thread panel does not: `CometChatThreadHeader` takes its own `textFormatters` (CometChatThreadHeader.tsx:96) and passes it into `getAllMessageTemplates` (:280), which builds the parent message bubble. Leave it off and the message at the top of a thread renders the raw marker while the replies below it show color. The word "thread" did not appear anywhere on the page. React's guide already lists `CometChatThreadHeader` in its Step 7. Verified before writing it down: `applyRawFormatters` returns the text untouched when given no formatters and the kit's own `matchColorTagAt` does not recognise a consumer token, so nothing downstream picks it up either; then ran the guide's formatter in the masterapp with the thread header registered and confirmed the parent message renders in color. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
e3e9a83 to
dac00c7
Compare
raj-dubey1
left a comment
There was a problem hiding this comment.
Docs review: approve ✅
Checked against the React Native UI Kit source (5.5.1 on master-v5) and the published 5.5.2.
- Correct:
CometChatThreadHeaderis a root export and takes its owntextFormattersprop. It passes the formatters into the parent message's template (CometChatThreadHeader.tsx:280), so it does not inherit them, and this step really was missing from the guide. The sample app'sThreadView.tsxalready registers a formatter on the thread header separately. - Structural checks: no 404s, no unresolved navigation refs, no broken links.
Optional nit: the thread's replies are a separate <CometChatMessageList parentMessage={…}>, and the thread composer is separate too, so both need textFormatters={[colorFormatter]} as well. The single <CometChatMessageList user={user} …/> line could leave readers thinking the main list covers threads. Half a sentence ("…and on the thread's message list and composer") would close that.
jitvarpatil
left a comment
There was a problem hiding this comment.
🤖 Review Buddy (review-docs-pr)
Recommendation: approve. Automated review; the final decision stays with a maintainer.
TL;DR — A 4-line, single-file fix to ui-kit/react-native/guide-custom-text-formatter.mdx: Step 4 now imports CometChatThreadHeader and registers the formatter on it, with a one-line comment explaining why the thread panel doesn't inherit it. The claim is verified against the RN UI Kit source (packages/ChatUiKit/src/CometChatThreadHeader/CometChatThreadHeader.tsx): parentMessage is a required prop (:39), textFormatters? is a declared prop (:92), and it is passed into getAllMessageTemplates(mergedTheme, { textFormatters }) (:246) which builds the parent-message bubble — so without it the parent message does render the raw marker. The snippet matches the React guide's equivalent line (ui-kit/react/guide-custom-text-formatter.mdx:390). No structural risk: no files moved, no docs.json change, no new links or images.
Findings
P0 — none.
P1 — none.
P2
PR description— "Our own sample app has always done this —ThreadView.tsxpasses a formatter to the thread header independently" is not what the sample does. Onmaster-v5,examples/masterapp/src/components/conversations/screens/ThreadView.tsx:270renders<CometChatThreadHeader parentMessage={message} receiptsVisibility={…} />with notextFormatters; the formatter at:278goes to the thread'sCometChatMessageList. The doc change is still correct (the prop exists and is consumed), but the justification in the PR body is wrong — worth fixing so nobody cites it later. (The:280line ref in the body is also:246onmaster-v5; harmless.)ui-kit/react-native/threaded-messages-header.mdx:14— the component reference page's prop summary lists onlyparentMessage·templateand never mentionstextFormattersanywhere on the page. Pre-existing gap, not introduced here, but now that the guide tells readers to passtextFormattersto the thread header, the reference page should document it. Suggested follow-up, not a blocker.
Passed / skipped
- ✅ Redirect coverage: 0 removed/renamed URLs (nothing to redirect).
- ✅ Chained 404s: 0.
- ✅ Navigation integrity (build): 0 dangling
docs.jsonrefs. - ✅ In-content link rot: 0 broken targets across 65 scanned
ui-kit/react-native/files. - ✅ Content integrity: prose and code agree; snippet is consistent with the rest of Step 4 and with the React guide; no version/package drift, no placeholders, no image refs added.
- ℹ️ Orphan
/ui-kit/react-native/llms-react-native-v5and a −21 redirect delta are both pre-existingmaindrift since the branch forked (Sep 30) — this PR does not touchdocs.json. - ⏭️ Mintlify build: not run locally; the
mintlify[bot]preview on the PR reports 🟢 Ready.
jitvarpatil
left a comment
There was a problem hiding this comment.
✅ Approved via Review Buddy after an automated review (P0: 0 · P1: 0 · P2: 2).
Findings: #548 (review)
The reference page never listed textFormatters (CometChatThreadHeader.tsx:96). It is not inherited from the message list, so say so and link the guide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ff9c5c3
raj-dubey1
left a comment
There was a problem hiding this comment.
Re-reviewed at ff9c5c3. Approving.
CometChatThreadHeaderdeclarestextFormatterswith the type documented here and passes it intogetAllMessageTemplates(...)for the parent message (CometChatThreadHeader.tsx:96,:280on v5.5.2, unchanged since 5.5.0). So the guide step and the new Text Formatters section onthreaded-messages-header.mdxare both accurate.- Structural checks pass: no 404s, no unresolved nav refs, no broken links in
ui-kit/react-native/. Mintlify deployment and link-rot checks are green.
Optional follow-up, not blocking: the thread's own CometChatMessageList parentMessage={…} and its composer also need textFormatters. Also, a matching custom template on the thread header bypasses textFormatters.
Problem
Step 4 of the React Native Custom Text Formatter guide lists five surfaces and then says the rest inherit the formatter from the component that renders them.
CometChatThreadHeaderdoes not.The word "thread" did not appear anywhere on the page. A reader who follows the guide exactly ships a thread whose parent message shows the raw
{color:…}marker, while the replies below it render in colour — a confusing symptom, and one you only hit after opening a thread, so it survives a casual test pass.React's guide already lists
CometChatThreadHeaderin its Step 7.Why it is not inherited
It takes its own
textFormattersand feeds it into the template builder that renders the parent message bubble:Our own sample app has always done this —
ThreadView.tsxpasses a formatter to the thread header independently of the main chat. That line would not be needed if it inherited.Verified, not assumed
The failure mode, before documenting it —
applyRawFormattersreturns the text untouched when given no formatters, and the kit's ownmatchColorTagAtdoes not recognise a consumer token, so nothing downstream picks it up either:The fix, on a simulator — the guide's own formatter, extracted verbatim by script, registered per this change, with the parent message at the top of the thread rendering in colour.
Context
Raised from a customer ticket about colour not surviving between Web and React Native. The reply points at this guide, so the gap would have been the customer's next question.
🤖 Generated with Claude Code