Skip to content

A Text's baseline leaves out its paddingTop, so alignItems: 'baseline' places a padded Text as if it had no padding #60338

Backlog

Description

@YevheniiKotyrlo

Description

In a row with alignItems: 'baseline', a Text with paddingTop is placed as if it had no padding: its top lines up with the other Text's top, so its text sits lower by the padding.

Yoga reads a baseline function's answer as the distance from the node's top and passes it the node's whole width and height (calculateBaseline). ParagraphShadowNode::baseline lays the lines out in that size and returns lines[0].ascender without the top padding, while ParagraphShadowNode::layout draws the text in the content frame, below the padding. The function came in with #45102.

Steps to reproduce

  1. Clone the reproducer below and run bash ./reproduce-android.sh with an Android device on adb (it builds the app in Release, installs and launches it, and reads the log), or cd ReproducerApp && yarn install && yarn android. The app renders:

    <View style={{ flexDirection: 'row', alignItems: 'baseline' }}>
      <Text style={{ fontSize: 20 }}>A</Text>
      <Text style={{ fontSize: 20, paddingTop: 30, backgroundColor: '#ffe08a' }}>B</Text>
    </View>
  2. Read the two Texts' onLayout y values on the screen, or in logcat under ReactNativeJS.

Expected: the A and the B sit on one baseline, so A's y is 30 and B's is 0.
Actual: A's y and B's y are both 0, and the B sits 30 below the A.

React Native Version

0.88.1, and 0.90.0-nightly-20261128-32260ddbe

Affected Platforms

Runtime - Android

Areas

Fabric - The New Renderer

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: 146.16 GB / 255.67 GB
Binaries:
  Node:
    version: 26.12.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: ~\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: 20.2.0
    wanted: 20.2.0
  react:
    installed: 19.3.0
    wanted: 19.3.0
  react-native:
    installed: 0.88.1
    wanted: 0.88.1
  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

MINGW64_NT-10.0-26300 x86_64, node v26.12.1, device SM-S911B on Android 14
react-native 0.88.1
[…]
BUILD SUCCESSFUL in 3m 16s
[…]
Text A onLayout: y=0 height=27
Text B onLayout: y=0 height=57
SUMMARY: A y=0, B y=0: the tops sit level, so B's baseline leaves out its paddingTop: 30 (expected A y=30, B y=0)

The reproducer's nightly branch, on 0.90.0-nightly-20261128-32260ddbe:

MINGW64_NT-10.0-26300 x86_64, node v26.12.1, device SM-S911B on Android 14
react-native 0.90.0-nightly-20261128-32260ddbe
[…]
BUILD SUCCESSFUL in 5m 46s
[…]
Text A onLayout: y=0 height=27
Text B onLayout: y=0 height=57
SUMMARY: A y=0, B y=0: the tops sit level, so B's baseline leaves out its paddingTop: 30 (expected A y=30, B y=0)

MANDATORY Reproducer

https://github.com/YevheniiKotyrlo/text-baseline-leaves-out-padding

Screenshots and Videos

Galaxy S23, Android 14, release build of the reproducer on 0.88.1:

Activity

  1. added
    Type: New Architecture
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Triage 🔍Type: New Architecture

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions