From f1f516e8cb2f6c085bcc08838066b5b49c08da3b Mon Sep 17 00:00:00 2001 From: Peter Abbondanzo Date: Mon, 19 Oct 2026 18:24:31 -0700 Subject: [PATCH] Support SelectableParagraph in fantom tester (#59210) Summary: Pull Request resolved: https://github.com/react/react-native/pull/59210 The fantom test renderer only rendered text children for Paragraph nodes and its stub component registry did not register the SelectableParagraph descriptor, so selectable text fell back to an unimplemented view with empty output. Register the SelectableParagraph descriptor and render its children from ParagraphState the same way as Paragraph, so selectable text stays observable in test output. Changelog: [Internal] Differential Revision: D126186990 fbshipit-source-id: 58e55b819a70c17878daf691c46d798e8666ff6a --- .../react-native-fantom/tester/src/render/RenderOutput.cpp | 5 ++++- .../tester/src/stubs/StubComponentRegistryFactory.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/private/react-native-fantom/tester/src/render/RenderOutput.cpp b/private/react-native-fantom/tester/src/render/RenderOutput.cpp index 28ab558d2f2..edec6ff4680 100644 --- a/private/react-native-fantom/tester/src/render/RenderOutput.cpp +++ b/private/react-native-fantom/tester/src/render/RenderOutput.cpp @@ -50,7 +50,10 @@ folly::dynamic RenderOutput::renderView( folly::dynamic props = folly::dynamic::object; #endif - if (std::string_view(view.componentName) == "Paragraph") { + // SelectableParagraph shares ParagraphState with Paragraph; render its text + // the same way so selectable text stays observable in test output. + if (std::string_view(view.componentName) == "Paragraph" || + std::string_view(view.componentName) == "SelectableParagraph") { const auto& state = static_cast&>(*view.state); element["children"] = diff --git a/private/react-native-fantom/tester/src/stubs/StubComponentRegistryFactory.h b/private/react-native-fantom/tester/src/stubs/StubComponentRegistryFactory.h index f7b4a5861e7..b68623060fa 100644 --- a/private/react-native-fantom/tester/src/stubs/StubComponentRegistryFactory.h +++ b/private/react-native-fantom/tester/src/stubs/StubComponentRegistryFactory.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,7 @@ inline ComponentRegistryFactory getDefaultComponentRegistryFactory() providerRegistry->add(concreteComponentDescriptorProvider()); providerRegistry->add(concreteComponentDescriptorProvider()); providerRegistry->add(concreteComponentDescriptorProvider()); + providerRegistry->add(concreteComponentDescriptorProvider()); providerRegistry->add(concreteComponentDescriptorProvider()); providerRegistry->add(concreteComponentDescriptorProvider()); providerRegistry->add(concreteComponentDescriptorProvider());