mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fabric: EdgeInsets from dynamic conversion
Summary: We will need this for several components, first of all for ScrollView. Reviewed By: fkgozali Differential Revision: D7958246 fbshipit-source-id: 364b939abe8f0734376448149bbdc735abd00189
This commit is contained in:
1 parent
545f087b46
commit
30d08ea8a4
1 file changed
+13
@@ -75,6 +75,19 @@ inline void fromDynamic(const folly::dynamic &value, Size &result) {
|
||||
abort();
|
||||
}
|
||||
|
||||
inline void fromDynamic(const folly::dynamic &value, EdgeInsets &result) {
|
||||
if (value.isArray()) {
|
||||
result = EdgeInsets {
|
||||
(Float)value[0].asDouble(),
|
||||
(Float)value[1].asDouble(),
|
||||
(Float)value[2].asDouble(),
|
||||
(Float)value[3].asDouble()
|
||||
};
|
||||
return;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
inline std::string toString(const Point &point) {
|
||||
return "{" + folly::to<std::string>(point.x) + ", " + folly::to<std::string>(point.y) + "}";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user