2018-05-08 04:49:23 +00:00
|
|
|
/**
|
|
|
|
* 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 "ParagraphProps.h"
|
|
|
|
|
|
|
|
#include <fabric/attributedstring/textValuesConversions.h>
|
|
|
|
#include <fabric/core/propsConversions.h>
|
|
|
|
#include <fabric/debug/DebugStringConvertibleItem.h>
|
|
|
|
#include <fabric/text/propsConversions.h>
|
|
|
|
|
|
|
|
namespace facebook {
|
|
|
|
namespace react {
|
|
|
|
|
|
|
|
void ParagraphProps::apply(const RawProps &rawProps) {
|
|
|
|
ViewProps::apply(rawProps);
|
2018-05-09 01:50:25 +00:00
|
|
|
BaseTextProps::apply(rawProps);
|
2018-05-08 04:49:23 +00:00
|
|
|
|
|
|
|
// Paragraph Attributes
|
|
|
|
applyRawProp(rawProps, "numberOfLines", paragraphAttributes_.maximumNumberOfLines);
|
|
|
|
applyRawProp(rawProps, "ellipsizeMode", paragraphAttributes_.ellipsizeMode);
|
|
|
|
applyRawProp(rawProps, "adjustsFontSizeToFit", paragraphAttributes_.adjustsFontSizeToFit);
|
|
|
|
applyRawProp(rawProps, "minimumFontSize", paragraphAttributes_.minimumFontSize);
|
|
|
|
applyRawProp(rawProps, "maximumFontSize", paragraphAttributes_.maximumFontSize);
|
|
|
|
|
|
|
|
// Other Props
|
|
|
|
applyRawProp(rawProps, "selectable", isSelectable_);
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Getters
|
|
|
|
|
|
|
|
ParagraphAttributes ParagraphProps::getParagraphAttributes() const {
|
|
|
|
return paragraphAttributes_;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ParagraphProps::getIsSelectable() const {
|
|
|
|
return isSelectable_;
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - DebugStringConvertible
|
|
|
|
|
|
|
|
SharedDebugStringConvertibleList ParagraphProps::getDebugProps() const {
|
|
|
|
SharedDebugStringConvertibleList list = {};
|
|
|
|
|
2018-05-09 01:50:25 +00:00
|
|
|
// View Props
|
|
|
|
auto &&viewPropsList = ViewProps::getDebugProps();
|
|
|
|
std::move(viewPropsList.begin(), viewPropsList.end(), std::back_inserter(list));
|
|
|
|
|
2018-05-08 04:49:23 +00:00
|
|
|
// Paragraph Props
|
|
|
|
auto &¶graphAttributePropsList = paragraphAttributes_.getDebugProps();
|
|
|
|
std::move(paragraphAttributePropsList.begin(), paragraphAttributePropsList.end(), std::back_inserter(list));
|
|
|
|
|
2018-05-09 01:50:25 +00:00
|
|
|
// Base Text Props
|
|
|
|
auto &&baseTextPropsList = BaseTextProps::getDebugProps();
|
|
|
|
std::move(baseTextPropsList.begin(), baseTextPropsList.end(), std::back_inserter(list));
|
2018-05-08 04:49:23 +00:00
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace react
|
|
|
|
} // namespace facebook
|