mirror of
https://github.com/status-im/react-native.git
synced 2025-01-17 04:50:59 +00:00
e2287976f3
Summary: `fabric/attributedstring` is a simple, cross-platfrom, react-specific implementation of attributed string (aka spanned string). This diff is the first part of this which contains text primitives (types) and conversions. Reviewed By: fkgozali Differential Revision: D7748704 fbshipit-source-id: d76e31807e5ac7ab1a16fd6ee6445c59de5b89a2
38 lines
1.3 KiB
C++
38 lines
1.3 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 "ParagraphAttributes.h"
|
|
|
|
#include <fabric/attributedstring/textValuesConversions.h>
|
|
#include <fabric/debug/DebugStringConvertibleItem.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
#pragma mark - DebugStringConvertible
|
|
|
|
SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const {
|
|
ParagraphAttributes defaultParagraphAttributes = {};
|
|
SharedDebugStringConvertibleList list = {};
|
|
|
|
#define PARAGRAPH_ATTRIBUTE(stringName, propertyName, accessor, convertor) \
|
|
if (propertyName != defaultParagraphAttributes.propertyName) { \
|
|
list.push_back(std::make_shared<DebugStringConvertibleItem>(#stringName, convertor(propertyName accessor))); \
|
|
}
|
|
|
|
PARAGRAPH_ATTRIBUTE(maximumNumberOfLines, maximumNumberOfLines, , std::to_string)
|
|
PARAGRAPH_ATTRIBUTE(ellipsizeMode, ellipsizeMode, , stringFromEllipsizeMode)
|
|
PARAGRAPH_ATTRIBUTE(adjustsFontSizeToFit, adjustsFontSizeToFit, , std::to_string)
|
|
PARAGRAPH_ATTRIBUTE(minimumFontSize, minimumFontSize, , std::to_string)
|
|
PARAGRAPH_ATTRIBUTE(maximumFontSize, maximumFontSize, , std::to_string)
|
|
|
|
return list;
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|