Skip to content

Keep nested Fantom Text children in arrays - #60315

Draft
GianSandoval5 wants to merge 1 commit into
react:mainfrom
GianSandoval5:fix/fantom-nested-text-children-60281
Draft

GianSandoval5 wants to merge 1 commit into
react:mainfrom
GianSandoval5:fix/fantom-nested-text-children-60281

Conversation

@GianSandoval5

Copy link
Copy Markdown

Summary:

Fixes #60281.

Fantom declares every rendered node's children as an array, but the native emitter stores a bare string for a nested Text fragment. The JavaScript prop filter preserves it, so consumers using the declared JSON shape can fail on array methods.

Emit a one-element array for nested fragment text, matching the existing Flow type and other nodes. Update the existing nested-text expectation, cover toJSONObject() and toJSON() with direct paragraph text surrounding a nested fragment, and verify that JSX output preserves the text after the nested content changes to Unicode.

This changes the internal raw shape from children: "text" to children: ["text"]; consumers relying on the previous raw shape must update expectations. This proposes a uniform-array contract rather than widening the type. No public React Native API is changed.

Changelog:

[INTERNAL] [FIXED] - Keep nested Fantom Text fragment children in arrays, matching the declared rendered-output JSON shape

Test Plan:

Base: dce80ca65a1848e4131f1292c31c87f36bed1e10. Verified on November 26, 2026 in the project's Android CI image v22.0, using Node 22.14.0, Yarn 1.22.22, OpenJDK 17.0.20.1 and Clang 14.0.0 (different from the reporter's Clang 23.1.3).

  • Baseline native build: exit 0. With the baseline emitter and new JSON expectations, Fantom-itest reports 41 passed, 2 failed, 4 skipped (exit 1). Both failures show a string received where an array is expected for nested fragment children.
  • Patched native rebuild: exit 0. Fantom-itest, FantomTextMeasurement-itest and Text-itest report 204 passed, 0 failed, 4 skipped (exit 0), including both new tests. Per-file passed counts: 43, 6 and 155.
  • The four existing it.skip cases cover task/microtask scheduling after errors and have TODO comments to fix that handling. They are unchanged on the base and patch.
  • Project Prettier, clang-format, ESLint (--max-warnings 0), full Flow check and source-restoration diff check: exit 0.

Commands:

yarn workspace @react-native/fantom build
yarn fantom private/react-native-fantom/src/__tests__/Fantom-itest.js --ci --runInBand --json --outputFile=verification-results/baseline.json
# Restore the patch and rebuild the native tester, then:
yarn fantom private/react-native-fantom/src/__tests__/Fantom-itest.js private/react-native-fantom/src/__tests__/FantomTextMeasurement-itest.js packages/react-native/Libraries/Text/__tests__/Text-itest.js --ci --runInBand --json --outputFile=verification-results/patched.json

Native build logs and JSON results: https://github.com/GianSandoval5/react-native/actions/runs/45823207836

The first verification run passed static checks but stopped before compilation because the shallow checkout lacked the baseline object. It is not counted as a product reproduction. The successful run fetches the recorded base, builds the actual Fantom/Hermes tester for baseline and patch, requires exactly the two contract failures, and then executes the three integration suites. The verification workflow and harness remain on a separate fork-only branch; this PR contains only two functional files.

Not run: Android/iOS application builds, physical devices, the whole Fantom/React Native suite, or public API snapshot generation (no public API/header changed). This Linux tester run is not Android/iOS validation.

AI-assisted implementation, based on the native emitter and existing suite. The issue's reproduction is credited through the link; its posted test was not copied into this contribution. Kept in draft for Gian's personal review and confirmation of Meta CLA coverage. No agreement is signed by this preparation.

@meta-cla

meta-cla Bot commented Nov 26, 2026

Copy link
Copy Markdown

Hi @GianSandoval5!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fantom: getRenderedOutput() gives a nested Text's children as a string, where FantomJsonObject types them as a list

1 participant