Skip to content

Fantom: UIManager.hasViewManagerConfig answers false for View, which the tester renders, as TesterMountingManager keeps IMountingManager's hasComponent default #60064

Open

Description

@YevheniiKotyrlo

Description

In a Fantom test, UIManager.hasViewManagerConfig(name) answers false for every component, View included, though the tester renders it. BridgelessUIManager.hasViewManagerConfig answers through unstable_hasComponent, which calls __nativeComponentRegistry__hasComponent; ReactHost on the cxx platform binds that to its mounting manager's hasComponent (ReactHost.cpp#L288-L294), and Fantom's TesterMountingManager does not override IMountingManager::hasComponent, whose default answers false (IMountingManager.h#L75-L78).

JavaScript that checks for a native component with UIManager.hasViewManagerConfig before rendering it takes its fallback in every Fantom test.

Steps to reproduce

  1. git clone https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer && cd react-native-fantom-reproducer
  2. ./fantom/reproduce.sh has-view-manager-config (needs Docker). It clones react/react-native at main, builds Fantom's tester, and runs this test, its license and Flow header left out here, as packages/react-native/Libraries/ReactNative/__tests__/HasViewManagerConfig-itest.js:
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';

import * as Fantom from '@react-native/fantom';
import * as React from 'react';
import {UIManager, View} from 'react-native';

describe('UIManager.hasViewManagerConfig', () => {
  it('renders View', () => {
    const root = Fantom.createRoot();
    Fantom.runTask(() => {
      root.render(<View nativeID="view" />);
    });
    expect(root.getRenderedOutput().toJSX()).toEqual(
      <rn-view nativeID="view" />,
    );
  });

  it('answers true for View', () => {
    expect(UIManager.hasViewManagerConfig('View')).toBe(true);
  });
});

The same on a checkout of main: put that file in place, then yarn workspace @react-native/fantom build and yarn fantom packages/react-native/Libraries/ReactNative/__tests__/HasViewManagerConfig-itest.js. The run ends with a SUMMARY: line and exits 1 while hasViewManagerConfig('View') answers false, 0 once both tests pass, and 2 when the tester does not build or the test fails another way.

Expected: both tests pass: hasViewManagerConfig answers true for a component the tester's component registry holds, and still false for a name it does not hold.

Seen: renders View passes, and answers true for View fails with Expected true but received false. (the log under Stacktrace or Logs).

React Native Version

main at c1acb2b (0.88.1 has the same ReactHost binding and IMountingManager default)

Affected Platforms

Build - Linux

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

react-native c1acb2bd63c491037cf683206c4efab88d3bfe70, committed 2026-11-16T23:51:06+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

FAIL fantom packages/react-native/Libraries/ReactNative/__tests__/HasViewManagerConfig-itest.js (6.506 s)
  UIManager.hasViewManagerConfig (hermes)
    ✓ renders View (59 ms)
    ✕ answers true for View

  ● UIManager.hasViewManagerConfig (hermes) › answers true for View

    Expected true but received false.
        at construct (native)
        at apply (native)

SUMMARY: View renders, but UIManager.hasViewManagerConfig('View') answers false

MANDATORY Reproducer

https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer

Screenshots and Videos

No response

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions