Repository navigation
fix(mobile): respect prose direction in chat and composer - #23587
haithamassoli44 wants to merge 3 commits into
Conversation
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — This PR introduces broad Android/iOS Markdown rendering and composer direction behavior, activates a 1,665-line production dependency patch, and changes the mobile Markdown component’s effective direction default. The resulting cross-platform regression surface is substantially larger than a self-contained bug fix. You can add or adjust custom eligibility rules. Learn more. |
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⛔ Files ignored due to path filters: 1
⚙️ Run configuration
⛔ Files ignored due to path filters: 1
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Yash-Singh1
left a comment
There was a problem hiding this comment.
This works well, but I am hesitant to bringing in such a large patch to enriched-markdown, would you be willing to open up PRs to upstream some of these patches to their repo?
Problem
Mobile still resolves mixed prose from its first letter, even after #22777 fixed web and desktop. In
StrictMode: يعيد العرض مرتين في التطوير, the English prefix makes the Arabic paragraph LTR. Inlinefetch()reads as()fetch, and RTL quote borders stay on the left. The same failure is reproducible in Hebrew.Change
Use #22777's word-majority rule in the shared native Markdown renderer and the native chat/new-thread composers. Ties follow the first word; code and chips do not vote.
word-majoritymode for iOS and Android. Lists and quotes share their block's direction; table cells resolve independently. Inline and fenced rendered code stay LTR.Scope and approval
Native follow-up to merged #22777 and the RTL rendering problem in #13622. The current native integration gap was also documented in the #16839 preflight. This uses the word policy already merged for web rather than introducing another direction heuristic.
The shared renderer covers user/assistant messages, review/PR Markdown and Markdown file previews. Composer changes cover chat and new-thread drafts. Provider adapters, server contracts and connection modes carry the same source text.
Verification
Rebuilt and verified matching native development clients on iPhone 18 Pro / iOS 27.0 and an Android 16 / API 36 emulator using
node scripts/mobile-native-client.ts ensure ...and a finalcheckon each platform.Matched captures show English-led Arabic/Hebrew headings and paragraphs resolving RTL, inline
fetch()retaining its order, quote borders on the right, and English/fenced code remaining LTR. The recordings exercise typing and a transition from an Arabic paragraph to an English paragraph. On Android, selected rich text containing inline code was copied and pasted into the composer; source prose/code remained intact without synthesized bidi controls.vp run check:changedpassed: format, lint, knip and typecheck of the 32 impacted packages. The dependency patch/lockfile expand this command's impact automatically.bash apps/mobile/modules/t3-composer-editor/tests/check-text-direction.shpassed 15 word-vote cases, 12 documents, and UTF-16/trailing-line checks.apps/mobile/android:./gradlew :t3-composer-editor:testDebugUnitTest --tests expo.modules.t3composereditor.ComposerTextDirectionTest :react-native-enriched-markdown:testDebugUnitTest --tests com.swmansion.enriched.markdown.utils.text.view.DirectionClipboardTestpassed 12 tests: 5 composer and 7 renderer/clipboard cases. These include actual Android span/layout APIs, multiline code extraction, authored marks, HTML, explicit table alignment and preservation of RTL-locale column order.Matched native captures
Both sides use the same isolated stopped-conversation fixtures with synthetic Arabic/Hebrew text. These verify client rendering, not a live provider response. Before uses native code from
8d3b061121fe; after uses this branch's rebuilt clients. PR-only assets are hosted on the fork release and are not committed.Typing recordings: iOS (31 seconds) · Android (13 seconds).
Limits
The Android plaintext composer receives isolated paragraph buffers: it excludes inline code from word voting, but does not isolate inline-code runs, resolve fence bodies from the whole document, or inherit direction for neutral-only lines. Rendered Markdown uses its AST for code and block direction. Scheduled-task prompts and review-comment inputs keep their existing native text-input behavior. Physical devices, hardware-keyboard editing, IME composition/cancellation and undo/redo were not checked.
Implemented with GPT-6.1 Sol using the Codex harness in T3 Code.