mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
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
This commit is contained in:
1 parent
1fcf9b87c8
commit
f1f516e8cb
2 files changed
+6
-1
No files matched your search
@@ -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<const ConcreteState<ParagraphState>&>(*view.state);
|
||||
element["children"] =
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <react/renderer/components/scrollview/ScrollViewComponentDescriptor.h>
|
||||
#include <react/renderer/components/text/ParagraphComponentDescriptor.h>
|
||||
#include <react/renderer/components/text/RawTextComponentDescriptor.h>
|
||||
#include <react/renderer/components/text/SelectableParagraphComponentDescriptor.h>
|
||||
#include <react/renderer/components/text/TextComponentDescriptor.h>
|
||||
#include <react/renderer/components/view/ViewComponentDescriptor.h>
|
||||
|
||||
@@ -29,6 +30,7 @@ inline ComponentRegistryFactory getDefaultComponentRegistryFactory()
|
||||
providerRegistry->add(concreteComponentDescriptorProvider<ParagraphComponentDescriptor>());
|
||||
providerRegistry->add(concreteComponentDescriptorProvider<ScrollViewComponentDescriptor>());
|
||||
providerRegistry->add(concreteComponentDescriptorProvider<RawTextComponentDescriptor>());
|
||||
providerRegistry->add(concreteComponentDescriptorProvider<SelectableParagraphComponentDescriptor>());
|
||||
providerRegistry->add(concreteComponentDescriptorProvider<TextComponentDescriptor>());
|
||||
providerRegistry->add(concreteComponentDescriptorProvider<ViewComponentDescriptor>());
|
||||
providerRegistry->add(concreteComponentDescriptorProvider<ModalHostViewComponentDescriptor>());
|
||||
|
||||
Reference in new issue
Block a user