Skip to content

Commit f1f516e

Browse files
Abbondanzometa-codesync[bot]
authored andcommitted
Support SelectableParagraph in fantom tester (#59210)
Summary: Pull Request resolved: #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
1 parent 1fcf9b8 commit f1f516e

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎private/react-native-fantom/tester/src/render/RenderOutput.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ folly::dynamic RenderOutput::renderView(
5050
folly::dynamic props = folly::dynamic::object;
5151
#endif
5252

53-
if (std::string_view(view.componentName) == "Paragraph") {
53+
// SelectableParagraph shares ParagraphState with Paragraph; render its text
54+
// the same way so selectable text stays observable in test output.
55+
if (std::string_view(view.componentName) == "Paragraph" ||
56+
std::string_view(view.componentName) == "SelectableParagraph") {
5457
const auto& state =
5558
static_cast<const ConcreteState<ParagraphState>&>(*view.state);
5659
element["children"] =

‎private/react-native-fantom/tester/src/stubs/StubComponentRegistryFactory.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <react/renderer/components/scrollview/ScrollViewComponentDescriptor.h>
1515
#include <react/renderer/components/text/ParagraphComponentDescriptor.h>
1616
#include <react/renderer/components/text/RawTextComponentDescriptor.h>
17+
#include <react/renderer/components/text/SelectableParagraphComponentDescriptor.h>
1718
#include <react/renderer/components/text/TextComponentDescriptor.h>
1819
#include <react/renderer/components/view/ViewComponentDescriptor.h>
1920

@@ -29,6 +30,7 @@ inline ComponentRegistryFactory getDefaultComponentRegistryFactory()
2930
providerRegistry->add(concreteComponentDescriptorProvider<ParagraphComponentDescriptor>());
3031
providerRegistry->add(concreteComponentDescriptorProvider<ScrollViewComponentDescriptor>());
3132
providerRegistry->add(concreteComponentDescriptorProvider<RawTextComponentDescriptor>());
33+
providerRegistry->add(concreteComponentDescriptorProvider<SelectableParagraphComponentDescriptor>());
3234
providerRegistry->add(concreteComponentDescriptorProvider<TextComponentDescriptor>());
3335
providerRegistry->add(concreteComponentDescriptorProvider<ViewComponentDescriptor>());
3436
providerRegistry->add(concreteComponentDescriptorProvider<ModalHostViewComponentDescriptor>());

0 commit comments

Comments
 (0)