Fabric/Text: Connecting the dots
Summary: This change registers the Text module. Reviewed By: mdvacca Differential Revision: D7784509 fbshipit-source-id: 0de3e432b8f975927547ba990586f99655e8322d
This commit is contained in:
parent
81bdd36204
commit
f3893aab3b
|
@ -63,7 +63,6 @@ static NSLineBreakMode RCTNSLineBreakModeFromWritingDirection(EllipsizeMode elli
|
||||||
[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:frame.origin];
|
[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:frame.origin];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (NSTextStorage *)_textStorageAndLayoutManagerWithAttributesString:(NSAttributedString *)attributedString
|
- (NSTextStorage *)_textStorageAndLayoutManagerWithAttributesString:(NSAttributedString *)attributedString
|
||||||
paragraphAttributes:(ParagraphAttributes)paragraphAttributes
|
paragraphAttributes:(ParagraphAttributes)paragraphAttributes
|
||||||
size:(CGSize)size
|
size:(CGSize)size
|
||||||
|
|
|
@ -52,6 +52,7 @@ rn_xplat_cxx_library(
|
||||||
"xplat//third-party/glog:glog",
|
"xplat//third-party/glog:glog",
|
||||||
react_native_xplat_target("fabric/core:core"),
|
react_native_xplat_target("fabric/core:core"),
|
||||||
react_native_xplat_target("fabric/debug:debug"),
|
react_native_xplat_target("fabric/debug:debug"),
|
||||||
|
react_native_xplat_target("fabric/text:text"),
|
||||||
react_native_xplat_target("fabric/view:view"),
|
react_native_xplat_target("fabric/view:view"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -39,12 +39,33 @@ static const RawProps rawPropsFromDynamic(const folly::dynamic object) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const std::string componentNameByReactViewName(std::string viewName) {
|
static const std::string componentNameByReactViewName(std::string viewName) {
|
||||||
|
// We need this function only for the transition period;
|
||||||
|
// eventually, all names will be unified.
|
||||||
|
|
||||||
std::string rctPrefix("RCT");
|
std::string rctPrefix("RCT");
|
||||||
if (std::mismatch(rctPrefix.begin(), rctPrefix.end(), viewName.begin()).first == rctPrefix.end()) {
|
if (std::mismatch(rctPrefix.begin(), rctPrefix.end(), viewName.begin()).first == rctPrefix.end()) {
|
||||||
// If `viewName` has "RCT" prefix, remove it.
|
// If `viewName` has "RCT" prefix, remove it.
|
||||||
viewName.erase(0, 3);
|
viewName.erase(0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fabric uses slightly new names for Text components because of differences
|
||||||
|
// in semantic.
|
||||||
|
if (viewName == "Text") {
|
||||||
|
return "Paragraph";
|
||||||
|
}
|
||||||
|
if (viewName == "VirtualText") {
|
||||||
|
return "Text";
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need this temporarly for testing purposes until we have proper
|
||||||
|
// implementation of <ScrollView> component.
|
||||||
|
if (
|
||||||
|
viewName == "ScrollContentView" ||
|
||||||
|
viewName == "ScrollView"
|
||||||
|
) {
|
||||||
|
return "View";
|
||||||
|
}
|
||||||
|
|
||||||
return viewName;
|
return viewName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
#include <fabric/core/LayoutContext.h>
|
#include <fabric/core/LayoutContext.h>
|
||||||
#include <fabric/uimanager/ComponentDescriptorRegistry.h>
|
#include <fabric/uimanager/ComponentDescriptorRegistry.h>
|
||||||
#include <fabric/uimanager/FabricUIManager.h>
|
#include <fabric/uimanager/FabricUIManager.h>
|
||||||
|
#include <fabric/text/ParagraphComponentDescriptor.h>
|
||||||
|
#include <fabric/text/TextComponentDescriptor.h>
|
||||||
|
#include <fabric/text/RawTextComponentDescriptor.h>
|
||||||
#include <fabric/view/ViewComponentDescriptor.h>
|
#include <fabric/view/ViewComponentDescriptor.h>
|
||||||
#include <fabric/view/ViewProps.h>
|
#include <fabric/view/ViewProps.h>
|
||||||
#include <fabric/view/ViewShadowNode.h>
|
#include <fabric/view/ViewShadowNode.h>
|
||||||
|
@ -16,8 +19,11 @@ namespace react {
|
||||||
|
|
||||||
Scheduler::Scheduler() {
|
Scheduler::Scheduler() {
|
||||||
auto componentDescriptorRegistry = std::make_shared<ComponentDescriptorRegistry>();
|
auto componentDescriptorRegistry = std::make_shared<ComponentDescriptorRegistry>();
|
||||||
SharedComponentDescriptor viewComponentDescriptor = std::make_shared<ViewComponentDescriptor>();
|
|
||||||
componentDescriptorRegistry->registerComponentDescriptor(viewComponentDescriptor);
|
componentDescriptorRegistry->registerComponentDescriptor(std::make_shared<ViewComponentDescriptor>());
|
||||||
|
componentDescriptorRegistry->registerComponentDescriptor(std::make_shared<ParagraphComponentDescriptor>());
|
||||||
|
componentDescriptorRegistry->registerComponentDescriptor(std::make_shared<TextComponentDescriptor>());
|
||||||
|
componentDescriptorRegistry->registerComponentDescriptor(std::make_shared<RawTextComponentDescriptor>());
|
||||||
|
|
||||||
uiManager_ = std::make_shared<FabricUIManager>(componentDescriptorRegistry);
|
uiManager_ = std::make_shared<FabricUIManager>(componentDescriptorRegistry);
|
||||||
uiManager_->setDelegate(this);
|
uiManager_->setDelegate(this);
|
||||||
|
|
Loading…
Reference in New Issue