Repository navigation
Description
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
-
Clone the reproducer below and run
bash repro.shon Ubuntu 24.04 withclang curl git libboost-dev libgoogle-glog-dev libdouble-conversion-devfrom apt, or thedocker runline in its README. It downloads react-native'smain, and clones folly, fast_float and fmt at the versionspackages/react-native/gradle/libs.versions.tomlpins. -
It compiles
repro.cppwith everyplatform/cxxfolder of ReactCommon on the include path, as Fantom's tester builds it.repro.cppincludesTextLayoutManagerExtended.hand 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