mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
bdad5f6432
commit
acb57ff2b6
@@ -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"),
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/debug/react_native_assert.h>
|
||||
#include <react/renderer/components/iospicker/primitives.h>
|
||||
|
||||
#include <vector>
|
||||
@@ -17,26 +18,26 @@ namespace react {
|
||||
inline void fromRawValue(
|
||||
const RawValue &value,
|
||||
std::vector<PickerItemsStruct> &items) {
|
||||
assert(value.hasType<std::vector<RawValue>>());
|
||||
react_native_assert(value.hasType<std::vector<RawValue>>());
|
||||
auto array = (std::vector<RawValue>)value;
|
||||
items.reserve(array.size());
|
||||
|
||||
for (auto const &val : array) {
|
||||
bool check = val.hasType<better::map<std::string, RawValue>>();
|
||||
assert(check);
|
||||
react_native_assert(check);
|
||||
auto map = (better::map<std::string, RawValue>)val;
|
||||
PickerItemsStruct item;
|
||||
|
||||
if (map.find("label") != map.end()) {
|
||||
assert(map.at("label").hasType<std::string>());
|
||||
react_native_assert(map.at("label").hasType<std::string>());
|
||||
item.label = (std::string)map.at("label");
|
||||
}
|
||||
if (map.find("value") != map.end()) {
|
||||
assert(map.at("value").hasType<std::string>());
|
||||
react_native_assert(map.at("value").hasType<std::string>());
|
||||
item.value = (std::string)map.at("value");
|
||||
}
|
||||
if (map.find("textColor") != map.end()) {
|
||||
assert(map.at("textColor").hasType<int>());
|
||||
react_native_assert(map.at("textColor").hasType<int>());
|
||||
item.textColor = (int)map.at("textColor");
|
||||
}
|
||||
items.push_back(item);
|
||||
|
||||
Reference in New Issue
Block a user