Skip to content

The cxx platform's TextLayoutManager declares no measureLines, so a Text's baseline is 0 and onTextLayout never fires in Fantom #60337

Backlog

Description

@YevheniiKotyrlo

Description

The cxx platform's TextLayoutManager (platform/cxx/.../TextLayoutManager.h), which Fantom's tester builds, declares measure and no measureLines, so TextLayoutManagerExtended::supportsLineMeasurement() is false there; leaving measureLines out is allowed by design since #50889. The Android and iOS managers both declare measureLines (Android, iOS).

With it false, ParagraphShadowNode::baseline logs Baseline alignment is not supported by the current platform and returns 0 for every Text, and layout logs onTextLayout is not supported by the current platform and never emits onTextLayout. Fantom's FantomTextLayoutManager subclasses this manager and lays text out in lines with Skia, but measure is the only member it can override, so it has no way to answer them. #60336 (open) adds a virtual measureLines to this manager and overrides it in FantomTextLayoutManager.

Steps to reproduce

  1. Clone the reproducer below and run bash repro.sh on Ubuntu 24.04 with clang curl git libboost-dev libgoogle-glog-dev libdouble-conversion-dev from apt, or the docker run line in its README. It downloads react-native's main, and clones folly, fast_float and fmt at the versions packages/react-native/gradle/libs.versions.toml pins.

  2. It compiles repro.cpp with every platform/cxx folder of ReactCommon on the include path, as Fantom's tester builds it. repro.cpp includes TextLayoutManagerExtended.h and asserts:

    #include <react/renderer/textlayoutmanager/TextLayoutManagerExtended.h>
    
    static_assert(facebook::react::TextLayoutManagerExtended::supportsLineMeasurement());

Expected: repro.cpp compiles, as it would with the Android or iOS platform folder: the cxx TextLayoutManager declares a measureLines(const AttributedStringBox &, const ParagraphAttributes &, const Size &) const returning LinesMeasurements that a subclass such as FantomTextLayoutManager can override, and its measure stays as it is.
Actual: the static assertion fails.

React Native Version

0.88.1

Affected Platforms

Other (please specify)

Areas

Fabric - The New Renderer

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

Not an app. The reproducer compiles ReactCommon from react-native's main at 94aee19ac9 with its cxx platform folders
(0.88.1 and 0.89.0-rc.3 declare the same cxx TextLayoutManager), on Ubuntu 24.04 with clang 18.1.3,
folly 2024.11.18.00, fast_float 8.0.0 and fmt 12.1.0.

Stacktrace or Logs

[…]
react/react-native 94aee19ac9, Ubuntu clang version 18.1.3 (1ubuntu1), Linux x86_64
folly 2024.11.18.00, fast_float 8.0.0 and fmt 12.1.0, as libs.versions.toml pins them
repro.cpp includes ReactCommon/react/renderer/textlayoutmanager/platform/cxx/react/renderer/textlayoutmanager/TextLayoutManager.h, whose TextLayoutManager declares these members:
  explicit TextLayoutManager(const std::shared_ptr<const ContextContainer> &contextContainer);
  virtual ~TextLayoutManager() = default;
  TextLayoutManager(const TextLayoutManager &) = delete;
  TextLayoutManager &operator=(const TextLayoutManager &) = delete;
  TextLayoutManager(TextLayoutManager &&) = delete;
  TextLayoutManager &operator=(TextLayoutManager &&) = delete;
  virtual TextMeasurement measure(
compiling repro.cpp: static_assert(facebook::react::TextLayoutManagerExtended::supportsLineMeasurement());
repro.cpp:5:15: error: static assertion failed due to requirement 'facebook::react::TextLayoutManagerExtended<facebook::react::TextLayoutManager>::supportsLineMeasurement()'
summary: react/react-native 94aee19ac9: TextLayoutManagerExtended::supportsLineMeasurement() is false for the cxx platform's TextLayoutManager

MANDATORY Reproducer

https://github.com/YevheniiKotyrlo/cxx-text-layout-manager-measure-lines

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