Repository navigation
Description
Description
Fantom.createRoot({viewportHeight: Infinity}) aborts the Fantom tester with SIGABRT on the root's first commit, and so does Fantom.createRoot({viewportWidth: Infinity}): the test file fails with Test suite failed to run and no JavaScript error. TesterAppDelegate::startSurface makes the viewport both the root's minimumSize and its maximumSize (TesterAppDelegate.cpp#L276-L281), so an infinite side becomes an infinite minimum, which YogaLayoutableShadowNode::layoutTree asserts against (YogaLayoutableShadowNode.cpp#L737-L739). createRoot hands both options to NativeFantom.startSurface as given (index.js#L126-L142).
So no Fantom test can lay a root out to its content's height or width. On Android, a side the parent leaves UNSPECIFIED gets a minimum of 0 and a maximum of infinity (LayoutMetricsConversions.kt#L18-L31).
Steps to reproduce
git clone https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer && cd react-native-fantom-reproducer./fantom/reproduce.sh infinite-viewport(needs Docker). It clonesreact/react-nativeatmain, builds Fantom's tester, and runs three tests, each in a file of its own underpackages/react-native/Libraries/Components/View/__tests__/, since an abort fails every test of its file.InfiniteViewportHeight-itest.js, its license and Flow header left out here:
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
import * as Fantom from '@react-native/fantom';
import * as React from 'react';
import {View} from 'react-native';
describe('Fantom.createRoot({viewportHeight: Infinity})', () => {
it('lays out a View of the root', () => {
const root = Fantom.createRoot({viewportHeight: Infinity});
Fantom.runTask(() => {
root.render(<View style={{height: 10}} collapsable={false} />);
});
expect(
root
.getRenderedOutput({
includeLayoutMetrics: true,
props: ['^layoutMetrics-frame$'],
})
.toJSX(),
).toEqual(<rn-view layoutMetrics-frame="{x:0,y:0,width:390,height:10}" />);
});
});FiniteViewport-itest.js is the same test with Fantom.createRoot(); InfiniteViewportWidth-itest.js creates its root with {viewportWidth: Infinity}, renders style={{width: 10, height: 10}} and expects {x:0,y:0,width:10,height:10}.
The same on a checkout of main: put those files in place, then yarn workspace @react-native/fantom build and yarn fantom packages/react-native/Libraries/Components/View/__tests__/InfiniteViewportHeight-itest.js. The script ends with a SUMMARY: line and exits 1 while either infinite root aborts the tester at its side's assertion, 0 once each lays its View out or createRoot throws an error naming its option, and 2 when the tester does not build, the default root fails, or a test fails another way.
Expected: each root lays its View out, a root's infinite side taking its content's size, as a minimum of 0 and a maximum of infinity give it; a finite viewport keeps both its minimum and its maximum. Or else createRoot throws an error naming viewportHeight or viewportWidth.
Seen: FiniteViewport-itest.js passes; the tester aborts with SIGABRT at !std::isinf(minimumSize.height) for the infinite height, and at !std::isinf(minimumSize.width) for the infinite width (the log under Stacktrace or Logs).
React Native Version
main at d6ea9fc (0.88.0 has the same startSurface constraints and assertion)
Affected Platforms
Build - Linux
Output of npx @react-native-community/cli info
react-native d6ea9fc1eed3da1bbb74d8a8ad77d539c430a7cf, committed 2026-11-22T00:35:34+00:00
clang version 23.1.3 (https://github.com/llvm/llvm-project 0d261d1ca552c95a8f007e061c787ac7132fbcbc)
Built and run in reactnativecommunity/react-native-android:v22.0 under Docker, as Fantom's CI job builds the tester, with LLVM 23.1.3's Clang.
Stacktrace or Logs
PASS fantom packages/react-native/Libraries/Components/View/__tests__/FiniteViewport-itest.js (9.81 s)
Fantom.createRoot() (hermes)
✓ lays out a View of the root (106 ms)
[…]
FAIL fantom packages/react-native/Libraries/Components/View/__tests__/InfiniteViewportHeight-itest.js
● Test suite failed to run
Command failed (status code: (empty), signal: SIGABRT): /react-native/private/react-native-fantom/build/tester/fantom_tester --bundlePath /react-native/private/react-native-fantom/.out/js-builds/run-1795332785914/1795332798334-InfiniteViewportHeight-itest.js.bundle.js --featureFlags {} --minLogLevel error
stdout:
(empty)
stderr:
E1122 07:33:20.284797 2235092736 YogaLayoutableShadowNode.cpp:739] react_native_assert failure: !std::isinf(minimumSize.height)
fantom_tester: /react-native/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp:739: virtual void facebook::react::YogaLayoutableShadowNode::layoutTree(LayoutContext, LayoutConstraints): Assertion `!std::isinf(minimumSize.height)' failed.
[…]
FAIL fantom packages/react-native/Libraries/Components/View/__tests__/InfiniteViewportWidth-itest.js
● Test suite failed to run
Command failed (status code: (empty), signal: SIGABRT): /react-native/private/react-native-fantom/build/tester/fantom_tester --bundlePath /react-native/private/react-native-fantom/.out/js-builds/run-1795332802961/1795332812344-InfiniteViewportWidth-itest.js.bundle.js --featureFlags {} --minLogLevel error
stdout:
(empty)
stderr:
E1122 07:33:33.826282 3400724224 YogaLayoutableShadowNode.cpp:738] react_native_assert failure: !std::isinf(minimumSize.width)
fantom_tester: /react-native/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp:738: virtual void facebook::react::YogaLayoutableShadowNode::layoutTree(LayoutContext, LayoutConstraints): Assertion `!std::isinf(minimumSize.width)' failed.
[…]
SUMMARY: createRoot({viewportHeight: Infinity}) aborts the tester with SIGABRT at !std::isinf(minimumSize.height); createRoot({viewportWidth: Infinity}) aborts the tester with SIGABRT at !std::isinf(minimumSize.width)
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer
Screenshots and Videos
No response
Activity