Skip to content

[Android][RN 0.81] TextLayoutEvent reports multiple lines for single-line text #54231

@vicprz

Description

@vicprz

Description

On Android, since Expo SDK 54 / React Native 0.81, the TextLayoutEvent nativeEvent.lines array can have more lines than the text actually has.

The bug only occurs with some strings (in my example, I have the bug with the string AAAA, but not with the string AAA).

I was able to reproduce the bug when the text is centered in a view (alignItems: 'center' on the parent view), and not when I remove the alignItems: 'center'.

Finally, I think the bug depends on device's screen dimensions, because on Expo Snack, with my example string, I have the bug on a Pixel 8, but not on a Pixel 9 Pro.

Steps to reproduce

  1. Launch the Snack
  2. Select an Android device and a Pixel 8 model
  3. Observe: on the device, the text is rendered on one line, but in the logs, e.nativeEvent.lines.length returns 2

React Native Version

0.81.5

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

N/A since I'm using Expo Snack

Stacktrace or Logs

N/A since it's not a crash

MANDATORY Reproducer

https://snack.expo.dev/@victorpe/bug---text-layout-event-reports-multiple-lines-for-single-line-text-on-android?platform=android

Screenshots and Videos

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions