mirror of
https://github.com/status-im/react-native.git
synced 2025-01-17 21:11:45 +00:00
ecbe9acbaa
Summary: @public Trivial. We move all components into `/components/` subdirectory. Reviewed By: mdvacca Differential Revision: D8757014 fbshipit-source-id: 9db94d38fe027e9125d017a17cbd4cf79f0bcf88
61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#include "ParagraphShadowNode.h"
|
|
|
|
#include <fabric/debug/DebugStringConvertibleItem.h>
|
|
|
|
#import "ParagraphLocalData.h"
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
ComponentName ParagraphShadowNode::getComponentName() const {
|
|
return ComponentName("Paragraph");
|
|
}
|
|
|
|
AttributedString ParagraphShadowNode::getAttributedString() const {
|
|
if (!cachedAttributedString_.has_value()) {
|
|
cachedAttributedString_ =
|
|
BaseTextShadowNode::getAttributedString(getProps()->textAttributes, getChildren());
|
|
}
|
|
|
|
return cachedAttributedString_.value();
|
|
}
|
|
|
|
void ParagraphShadowNode::setTextLayoutManager(SharedTextLayoutManager textLayoutManager) {
|
|
ensureUnsealed();
|
|
textLayoutManager_ = textLayoutManager;
|
|
}
|
|
|
|
void ParagraphShadowNode::updateLocalData() {
|
|
ensureUnsealed();
|
|
|
|
auto localData = std::make_shared<ParagraphLocalData>();
|
|
localData->setAttributedString(getAttributedString());
|
|
localData->setTextLayoutManager(textLayoutManager_);
|
|
setLocalData(localData);
|
|
}
|
|
|
|
#pragma mark - LayoutableShadowNode
|
|
|
|
Size ParagraphShadowNode::measure(LayoutConstraints layoutConstraints) const {
|
|
return textLayoutManager_->measure(
|
|
getAttributedString(),
|
|
getProps()->paragraphAttributes,
|
|
layoutConstraints
|
|
);
|
|
}
|
|
|
|
void ParagraphShadowNode::layout(LayoutContext layoutContext) {
|
|
updateLocalData();
|
|
ConcreteViewShadowNode<ParagraphProps>::layout(layoutContext);
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|