mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-26 18:53:19 +08:00
Fabric: New nice way to deal with DebugStringConvertible items
Summary: No macros in product code. (Not all callsites are converted yet.) Reviewed By: mdvacca Differential Revision: D7797561 fbshipit-source-id: da899421bf99669a0e0a2b83df6004daf14355c2
This commit is contained in:
committed by
Facebook Github Bot
parent
d9ff1769aa
commit
6e537b000b
@@ -10,27 +10,21 @@
|
||||
#include <fabric/attributedstring/textValuesConversions.h>
|
||||
#include <fabric/debug/DebugStringConvertibleItem.h>
|
||||
|
||||
#include "debugStringConvertibleUtils.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;
|
||||
return {
|
||||
debugStringConvertibleItem("maximumNumberOfLines", maximumNumberOfLines),
|
||||
debugStringConvertibleItem("ellipsizeMode", ellipsizeMode),
|
||||
debugStringConvertibleItem("adjustsFontSizeToFit", adjustsFontSizeToFit),
|
||||
debugStringConvertibleItem("minimumFontSize", minimumFontSize),
|
||||
debugStringConvertibleItem("maximumFontSize", maximumFontSize)
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
|
||||
Reference in New Issue
Block a user