-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathconversions.h
More file actions
47 lines (40 loc) · 1.85 KB
/
Copy pathconversions.h
File metadata and controls
47 lines (40 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include <folly/dynamic.h>
#include <react/renderer/components/FBReactNativeSpec/Props.h>
#include <react/renderer/components/ReactNativeEnrichedSpec/Props.h>
#include <react/renderer/core/propsConversions.h>
namespace facebook::react {
#ifdef RN_SERIALIZABLE_STATE
inline folly::dynamic toDynamic(const EnrichedTextInputViewProps &props) {
// Serialize only metrics affecting props
folly::dynamic serializedProps = folly::dynamic::object();
serializedProps["defaultValue"] = props.defaultValue;
serializedProps["placeholder"] = props.placeholder;
serializedProps["fontSize"] = props.fontSize;
serializedProps["fontWeight"] = props.fontWeight;
serializedProps["fontStyle"] = props.fontStyle;
serializedProps["fontFamily"] = props.fontFamily;
serializedProps["lineHeight"] = props.lineHeight;
serializedProps["allowFontScaling"] = props.allowFontScaling;
serializedProps["useHtmlNormalizer"] = props.useHtmlNormalizer;
serializedProps["htmlStyle"] = toDynamic(props.htmlStyle);
return serializedProps;
}
#endif
inline folly::dynamic toDynamic(const EnrichedTextViewProps &props) {
// Serialize only metrics affecting props
folly::dynamic serializedProps = folly::dynamic::object();
serializedProps["text"] = props.text;
serializedProps["fontSize"] = props.fontSize;
serializedProps["fontWeight"] = props.fontWeight;
serializedProps["fontStyle"] = props.fontStyle;
serializedProps["fontFamily"] = props.fontFamily;
serializedProps["lineHeight"] = props.lineHeight;
serializedProps["numberOfLines"] = props.numberOfLines;
serializedProps["ellipsizeMode"] = props.ellipsizeMode;
serializedProps["allowFontScaling"] = props.allowFontScaling;
serializedProps["useHtmlNormalizer"] = props.useHtmlNormalizer;
serializedProps["htmlStyle"] = toDynamic(props.htmlStyle);
return serializedProps;
}
} // namespace facebook::react