Repository navigation
Description
Description
I found this when the week heading of a calendar in an Arabic UI, {start} – {end} with each date wrapped in FSI…PDI isolates by the message formatter, came out in the wrong order on Android.
In an app with I18nManager.forceRTL(true), a <Text> whose strong characters all sit inside isolates, such as '\u2068Anna\u2069 – \u2068Bob\u2069', is laid out as a left-to-right paragraph: aligned to the right, but reading Anna – Bob from left to right, where a right-to-left paragraph gives Bob – Anna. The same string with a leading U+200F RIGHT-TO-LEFT MARK gives Bob – Anna, and writingDirection: 'rtl' changes nothing.
TextLayoutManager.buildLayout (L1061-L1121) builds the StaticLayout without setTextDirection, so the paragraph direction is StaticLayout.Builder's default, TextDirectionHeuristics.FIRSTSTRONG_LTR, which gives left to right when no strong character stands outside the isolates. measureText carries // TODO(5578671): Handle text direction (see View#getTextDirectionHeuristic) (L1692). A TextView whose text direction is TEXT_DIRECTION_FIRST_STRONG, the root view's default, falls back to the view's resolved layout direction instead. writingDirection reaches Android as TA_KEY_BEST_WRITING_DIRECTION, which TextAttributeProps ignores (L450).
Steps to reproduce
The reproducer calls I18nManager.allowRTL(true) and I18nManager.forceRTL(true) and renders four Texts, each <FSI>first<PDI> – <FSI>second<PDI> with the first value red and the second blue:
isolated names:Anna,Bob;isolated names, writingDirection rtl: the same, withwritingDirection: 'rtl';isolated Arabic dates:١١ يناير,١٧ يناير ٢٠٢٥;control: RLM, then isolated names: the first row behind a U+200F RIGHT-TO-LEFT MARK.
Then:
- Clone the reproducer and, with one Android device attached, run
./reproduce.sh. It builds and installs the release APK, clears the app's data, starts the app until it logsisRTL: true, takes a screenshot and reads where each row's red and blue pixels sit. - Or by hand:
cd ReproducerApp && yarn install && cd android && ./gradlew assembleRelease && adb install -r app/build/outputs/apk/release/app-release.apk, open the app, close it and open it again, so thatforceRTLapplies.
Expected: rows 1 to 3 laid out right to left, as row 4 is: the first value on the right, so rows 1 and 2 read Bob – Anna. A string with a strong character outside its isolates keeps taking its direction from that character.
Seen: rows 1 to 3 put the first value on the left, so rows 1 and 2 read Anna – Bob.
React Native Version
0.90.0-nightly-20261201-13d48c3d8
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
[…]
System:
OS: Windows 11 10.0.26300
CPU: "(32) x64 AMD Ryzen 9 9950X3D 16-Core Processor "
Memory: 172.33 GB / 255.67 GB
Binaries:
Node:
version: 26.13.1
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.22
path: C:\Users\<user>\AppData\Roaming\npm\yarn.CMD
npm:
version: 12.2.1
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
Versions:
- 10.0.19041.0
- 10.0.26100.0
IDEs:
Android Studio: AI-262.9437.185.2621.16467767
Visual Studio: Not Found
Languages:
Java:
version: 17.0.20.1
path: C:\Program Files\Microsoft\jdk-17.0.20.101-hotspot\bin\javac.EXE
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 22.0.0-alpha.0
wanted: 22.0.0-alpha.0
react:
installed: 19.3.0
wanted: 19.3.0
react-native:
installed: 0.90.0-nightly-20261201-13d48c3d8
wanted: 0.90.0-nightly-20261201-13d48c3d8
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
./reproduce.sh at the reproducer's 4ab8e6b, on an Android 16 emulator:
MINGW64_NT-10.0-26300 x86_64, node v26.13.1, openjdk version "17.0.20.1" 2026-08-18 LTS
device: sdk_gphone64_x86_64, Android 16 (API 36), x86_64
react-native 0.90.0-nightly-20261201-13d48c3d8
== ./gradlew :app:assembleRelease -PreactNativeArchitectures=x86_64
start 1: isRTL: false
start 2: isRTL: true
screenshot: screenshots/paragraph-direction.png
"isolated names": red "Anna" centred at x=698, blue "Bob" at x=960: the first value is on the left, as a left-to-right paragraph puts it
"isolated names, writingDirection rtl": red "Anna" centred at x=698, blue "Bob" at x=960: the first value is on the left, as a left-to-right paragraph puts it
"isolated Arabic dates": red "١١ يناير" centred at x=455, blue "١٧ يناير ٢٠٢٥" at x=857: the first value is on the left, as a left-to-right paragraph puts it
"control: RLM, then isolated names": red "Anna" centred at x=942, blue "Bob" at x=670: the first value is on the right, as a right-to-left paragraph puts it
SUMMARY: with I18nManager.isRTL true, 3 of 3 rows lay out their isolated values left to right, first value on the left ("isolated names", "isolated names, writingDirection rtl", "isolated Arabic dates"); the row that starts with a right-to-left mark puts it on the right
On an Android 15 (API 35) emulator it prints the same four row lines and summary.
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/rn-android-text-paragraph-direction
Screenshots and Videos
The reproducer on an Android 16 emulator, with I18nManager.isRTL true:

Activity