Skip to content

fix: UIKit block messages rendering with smaller font size - #7531

Open
OtavioStasiak wants to merge 3 commits into
developfrom
fix.apps-fontsize
Open

fix: UIKit block messages rendering with smaller font size#7531
OtavioStasiak wants to merge 3 commits into
developfrom
fix.apps-fontsize

Conversation

@OtavioStasiak

@OtavioStasiak OtavioStasiak commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

App (UIKit block) messages were rendering smaller than every other message in the list.

MessageParser.mrkdwn() passed a hardcoded textStyle={{ fontSize: 14 }} to Markdown, overriding the 16px message default while keeping lineHeight: 22 so app messages looked both smaller and cramped. It was inconsistent even within blocks, since plain_text() right above it already renders at 16.

Dropping the override makes block mrkdwn inherit the default message font size. The textStyle prop itself stays, so callers that genuinely need a different size can still opt in.

Note this also affects UIKit modals (ModalParser reuses MessageParser.prototype.mrkdwn) and info cards (InfoCard calls parser.mrkdwn), which now match the plain_text size in the same block.

Added a Section + Message font size parity story rendering a regular Markdown message next to the equivalent mrkdwn section, so any future divergence shows up as a snapshot diff.

Issue(s)

https://rocketchat.atlassian.net/browse/NATIVE-1186

How to test or reproduce

  • Open a channel with an app that posts block messages (e.g. the workspace-update message from Apps.QA)
  • Confirm its text now renders at the same size as regular messages around it

Screenshots

Before After
Screenshot 2026-07-30 at 10 29 03 Screenshot 2026-07-30 at 10 28 34

Voip Components

After Before
Simulator Screenshot - iPhone 16 - 2026-08-03 at 20 01 50 Simulator Screenshot - iPhone 16 - 2026-08-03 at 19 51 35
After Before
Simulator Screenshot - iPhone 16 - 2026-08-03 at 20 01 57 Simulator Screenshot - iPhone 16 - 2026-08-03 at 19 51 45
After Before
Simulator Screenshot - iPhone 16 - 2026-08-03 at 20 02 09 Simulator Screenshot - iPhone 16 - 2026-08-03 at 19 51 56
After Before
Simulator Screenshot - iPhone 16 - 2026-08-03 at 20 02 19 Simulator Screenshot - iPhone 16 - 2026-08-03 at 19 52 05

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Improved Markdown rendering in UIKit messages by ensuring section content uses consistent font sizing.
    • Updated multiline app-message Markdown presentation for better visual parity with equivalent UIKit-formatted content.
  • Tests

    • Added Storybook coverage to compare regular Markdown rendering with UIKit section formatting.

@OtavioStasiak
OtavioStasiak temporarily deployed to approve_e2e_testing July 30, 2026 13:17 — with GitHub Actions Inactive
if (isContext) {
return <MarkdownPreview msg={element.text} numberOfLines={0} />;
}
return <Markdown msg={element.i18n ? I18n.t(element.i18n.key) : element.text} textStyle={{ fontSize: 14 }} />;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing it the fontSize is 16 and it's the same that the other messages.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • app/containers/UIKit/__snapshots__/UiKitMessage.test.tsx.snap is excluded by !**/*.snap
  • app/containers/UIKit/__snapshots__/UiKitModal.test.tsx.snap is excluded by !**/*.snap

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c0c04bf0-7fa4-45af-a33a-a7bcf6d4d8a3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The UIKit mrkdwn renderer stops forcing a 14px text style. A Storybook story compares regular Markdown rendering with UIKit message sections using short and multiline content.

Changes

Markdown font-size parity

Layer / File(s) Summary
Renderer update and parity story
app/containers/UIKit/index.tsx, app/containers/UIKit/UiKitMessage.stories.tsx
The mrkdwn renderer relies on default Markdown styling. The new SectionFontSizeParity story compares regular Markdown with UIKit section rendering using short and multiline content.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the UIKit block message font-size bug fixed by the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (2)
  • NATIVE-1186: Request failed with status code 401
  • FD31-4452: Request failed with status code 401

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/containers/UIKit/UiKitMessage.stories.tsx (1)

65-65: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add an explicit return type to the new story component.

SectionFontSizeParity relies on inferred return typing. Add the repository’s preferred React element type annotation to comply with the TypeScript guideline. As per coding guidelines, TypeScript functions must declare explicit parameter and return types. Please verify the existing React type import before applying the annotation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/containers/UIKit/UiKitMessage.stories.tsx` at line 65, Update the
SectionFontSizeParity story component to declare the repository-preferred
explicit React element return type, reusing the existing React type import or
adding the appropriate type import if needed. Keep its current JSX output
unchanged and do not alter its parameters.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@app/containers/UIKit/UiKitMessage.stories.tsx`:
- Line 65: Update the SectionFontSizeParity story component to declare the
repository-preferred explicit React element return type, reusing the existing
React type import or adding the appropriate type import if needed. Keep its
current JSX output unchanged and do not alter its parameters.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6cbffa55-970c-4bc1-815d-c67835271466

📥 Commits

Reviewing files that changed from the base of the PR and between 7ae3df2 and 1947ec0.

⛔ Files ignored due to path filters (2)
  • app/containers/UIKit/__snapshots__/UiKitMessage.test.tsx.snap is excluded by !**/*.snap
  • app/containers/UIKit/__snapshots__/UiKitModal.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (2)
  • app/containers/UIKit/UiKitMessage.stories.tsx
  • app/containers/UIKit/index.tsx
📜 Review details
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,ts,jsx,tsx}: Use descriptive names for functions, variables, and classes that clearly convey their purpose
Write comments that explain the 'why' behind code decisions, not the 'what'
Keep functions small and focused on a single responsibility
Use const by default, let when reassignment is needed, and avoid var
Prefer async/await over .then() chains for handling asynchronous operations
Use explicit error handling with try/catch blocks for async operations
Avoid deeply nested code; refactor complex logic into helper functions

Files:

  • app/containers/UIKit/index.tsx
  • app/containers/UIKit/UiKitMessage.stories.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use TypeScript for type safety; add explicit type annotations to function parameters and return types
Prefer interfaces over type aliases for defining object shapes in TypeScript
Use enums for sets of related constants rather than magic strings or numbers

Files:

  • app/containers/UIKit/index.tsx
  • app/containers/UIKit/UiKitMessage.stories.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{js,jsx,ts,tsx}: Before committing changes to JavaScript or TypeScript files, run pnpm prettier-lint and TZ=UTC pnpm test for the modified files.
Use the local-first data flow: the UI reads from WatermelonDB, while sagas synchronize data with the server.
Use Redux and Redux-Saga for global or server state, and use Zustand for feature-local stores; do not assume all state is in Redux.

Files:

  • app/containers/UIKit/index.tsx
  • app/containers/UIKit/UiKitMessage.stories.tsx
🧠 Learnings (3)
📚 Learning: 2026-04-30T17:07:51.020Z
Learnt from: diegolmello
Repo: RocketChat/Rocket.Chat.ReactNative PR: 7274
File: app/lib/services/voip/MediaCallEvents.ts:0-0
Timestamp: 2026-04-30T17:07:51.020Z
Learning: In this Rocket.Chat React Native codebase, the ESLint rule `no-void: error` is enforced. When you see a promise returned from an async call that is not awaited (a “floating promise”), do not silence it with the `void somePromise()` pattern. Instead, handle the promise explicitly by attaching `.catch(...)` (or otherwise awaiting/handling the error) so unhandled-rejection risks are addressed in a way that satisfies the existing ESLint configuration.

Applied to files:

  • app/containers/UIKit/index.tsx
  • app/containers/UIKit/UiKitMessage.stories.tsx
📚 Learning: 2026-06-25T18:37:44.793Z
Learnt from: diegolmello
Repo: RocketChat/Rocket.Chat.ReactNative PR: 7434
File: app/views/ScreenLockConfigView.tsx:101-141
Timestamp: 2026-06-25T18:37:44.793Z
Learning: In the Rocket.Chat React Native codebase, do not treat passing an `async` function directly to an event prop in React/React Native UI components (e.g., `onPress={async () => ...}` in TSX) as a “floating promises” CI-blocking lint issue—this repo does not enable the ESLint `no-floating-promises` rule (while `no-void` is enforced). Only raise robustness follow-ups when there are genuinely unhandled promise paths (e.g., fire-and-forget calls like `save()` that return a Promise that is neither awaited nor handled), and prefer making sure failure paths are explicitly handled/reported rather than blocking on lint-style floating-promise concerns.

Applied to files:

  • app/containers/UIKit/index.tsx
  • app/containers/UIKit/UiKitMessage.stories.tsx
📚 Learning: 2026-03-15T13:55:42.038Z
Learnt from: Rohit3523
Repo: RocketChat/Rocket.Chat.ReactNative PR: 6911
File: app/containers/markdown/Markdown.stories.tsx:104-104
Timestamp: 2026-03-15T13:55:42.038Z
Learning: In Rocket.Chat React Native, the markdown parser requires a space between the underscore wrapping italic text and a mention sigil (_ mention _ instead of _mention_). Ensure stories and tests that include italic-wrapped mentions follow this form to guarantee proper parsing. Specifically, for files like app/containers/markdown/Markdown.stories.tsx, and any test/content strings that exercise italic-mentions, use the pattern _ mention _ (with spaces) to prevent the mention from being treated as plain text. Validate any test strings or story content accordingly.

Applied to files:

  • app/containers/UIKit/UiKitMessage.stories.tsx
🔇 Additional comments (2)
app/containers/UIKit/index.tsx (1)

96-96: LGTM!

app/containers/UIKit/UiKitMessage.stories.tsx (1)

5-5: LGTM!

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants