mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 09:45:04 +00:00
Fabric: More graphic values conversions from dynamic type
Summary: Trivial. Reviewed By: mdvacca Differential Revision: D7738578 fbshipit-source-id: 3112e523dd1cdceff90a8596033f9516aa2c8156
This commit is contained in:
parent
6aa52f2684
commit
139db66a3e
@ -69,5 +69,23 @@ std::string stringFromEdgeInsets(const EdgeInsets &edgeInsets) {
|
||||
folly::to<std::string>(edgeInsets.bottom) + "}";
|
||||
}
|
||||
|
||||
Float floatFromDynamic(const folly::dynamic &value) {
|
||||
return value.asDouble();
|
||||
}
|
||||
|
||||
Point pointFromDynamic(const folly::dynamic &value) {
|
||||
if (value.isArray()) {
|
||||
return Point {(Float)value[0].asDouble(), (Float)value[1].asDouble()};
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
Size sizeFromDynamic(const folly::dynamic &value) {
|
||||
if (value.isArray()) {
|
||||
return Size {(Float)value[0].asDouble(), (Float)value[1].asDouble()};
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
|
@ -26,5 +26,9 @@ std::string stringFromSize(const Size &size);
|
||||
std::string stringFromRect(const Rect &rect);
|
||||
std::string stringFromEdgeInsets(const EdgeInsets &edgeInsets);
|
||||
|
||||
Float floatFromDynamic(const folly::dynamic &value);
|
||||
Point pointFromDynamic(const folly::dynamic &value);
|
||||
Size sizeFromDynamic(const folly::dynamic &value);
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
|
Loading…
x
Reference in New Issue
Block a user