From 5a8cdb4bb7736f984051a2ed346bb3a5d11f7228 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Sat, 1 Jun 2019 12:44:26 -0700 Subject: [PATCH] Fabric: Additional temporary checks in prop parsing infra Summary: While ViewConfig infra isn't perfect we need to check that for correcness. See the task for more details. Reviewed By: JoshuaGross Differential Revision: D15578675 fbshipit-source-id: c99c2be9c215e6b9d7ee8e6e50d85e822c1f007e --- ReactCommon/fabric/components/image/conversions.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ReactCommon/fabric/components/image/conversions.h b/ReactCommon/fabric/components/image/conversions.h index 27b4960fa97..e1d8593b5c3 100644 --- a/ReactCommon/fabric/components/image/conversions.h +++ b/ReactCommon/fabric/components/image/conversions.h @@ -35,11 +35,18 @@ inline void fromRawValue(const RawValue &value, ImageSource &result) { } if (items.find("width") != items.end() && - items.find("height") != items.end()) { + items.find("height") != items.end() && + // The following checks have to be removed after codegen is shipped. + // See T45151459. + items.at("width").hasType() && + items.at("height").hasType()) { result.size = {(Float)items.at("width"), (Float)items.at("height")}; } - if (items.find("scale") != items.end()) { + if (items.find("scale") != items.end() && + // The following checks have to be removed after codegen is shipped. + // See T45151459. + items.at("scale").hasType()) { result.scale = (Float)items.at("scale"); } else { result.scale = items.find("deprecated") != items.end() ? 0.0 : 1.0;