From acb57ff2b631956804ed162e5ade590b8551579c Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Fri, 26 Feb 2021 23:26:05 -0800 Subject: [PATCH] ReactCommon/renderer/components/picker: Migrate uses of NDEBUG to REACT_NATIVE_DEBUG + react_native_assert Summary: For better cross-platform consistency, migrate usages of NDEBUG to REACT_NATIVE_DEBUG. See flags.h for explanation. Changelog: [Internal] Reviewed By: PeteTheHeat Differential Revision: D26695073 fbshipit-source-id: f59b6ce7d8f2fd2c68bba41070228be981684ce0 --- .../react/renderer/components/picker/iospicker/BUCK | 1 + .../components/picker/iospicker/conversions.h | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ReactCommon/react/renderer/components/picker/iospicker/BUCK b/ReactCommon/react/renderer/components/picker/iospicker/BUCK index 5ae7c276420..cfba993e953 100644 --- a/ReactCommon/react/renderer/components/picker/iospicker/BUCK +++ b/ReactCommon/react/renderer/components/picker/iospicker/BUCK @@ -48,6 +48,7 @@ rn_xplat_cxx_library( deps = [ "//xplat/folly:headers_only", YOGA_CXX_TARGET, + react_native_xplat_target("react/debug:debug"), react_native_xplat_target("react/utils:utils"), react_native_xplat_target("react/renderer/attributedstring:attributedstring"), react_native_xplat_target("react/renderer/core:core"), diff --git a/ReactCommon/react/renderer/components/picker/iospicker/conversions.h b/ReactCommon/react/renderer/components/picker/iospicker/conversions.h index b39f10431b7..c2577779cde 100644 --- a/ReactCommon/react/renderer/components/picker/iospicker/conversions.h +++ b/ReactCommon/react/renderer/components/picker/iospicker/conversions.h @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -17,26 +18,26 @@ namespace react { inline void fromRawValue( const RawValue &value, std::vector &items) { - assert(value.hasType>()); + react_native_assert(value.hasType>()); auto array = (std::vector)value; items.reserve(array.size()); for (auto const &val : array) { bool check = val.hasType>(); - assert(check); + react_native_assert(check); auto map = (better::map)val; PickerItemsStruct item; if (map.find("label") != map.end()) { - assert(map.at("label").hasType()); + react_native_assert(map.at("label").hasType()); item.label = (std::string)map.at("label"); } if (map.find("value") != map.end()) { - assert(map.at("value").hasType()); + react_native_assert(map.at("value").hasType()); item.value = (std::string)map.at("value"); } if (map.find("textColor") != map.end()) { - assert(map.at("textColor").hasType()); + react_native_assert(map.at("textColor").hasType()); item.textColor = (int)map.at("textColor"); } items.push_back(item);