mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix regression when setting shadow node properties in D38272966 (github PR merge)
Summary: Changelog: [Android][Fixed] - Fix regression when setting shadow node properties. Also simplified the corresponding macros to avoid using lambdas altogether, as they are not required. Note that this **does not** modify any constexpr-related semantics of the existing code, as the main constexpr macro, `CONSTEXPR_RAW_PROPS_KEY_HASH` evaluation result is still contstexpr value, and the other ones already involved non-const parts (see my comments). Reviewed By: NickGerleman Differential Revision: D38356411 fbshipit-source-id: 22c330d3425c8aed36693f4652f1b257d2dc96be
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c7c263dda8
commit
a142a78473
@@ -12,20 +12,17 @@
|
||||
#include <react/renderer/debug/DebugStringConvertibleItem.h>
|
||||
#include <react/renderer/graphics/conversions.h>
|
||||
|
||||
#define GET_FIELD_VALUE(field, fieldName, defaultValue, rawValue) \
|
||||
(rawValue.hasValue() ? ([&rawValue, &context] { \
|
||||
decltype(defaultValue) res; \
|
||||
fromRawValue(context, rawValue, res); \
|
||||
return res; \
|
||||
}()) \
|
||||
: defaultValue);
|
||||
|
||||
#define REBUILD_FIELD_SWITCH_CASE( \
|
||||
defaults, rawValue, property, field, fieldName) \
|
||||
case CONSTEXPR_RAW_PROPS_KEY_HASH(fieldName): { \
|
||||
property.field = \
|
||||
GET_FIELD_VALUE(field, fieldName, defaults.field, rawValue); \
|
||||
return; \
|
||||
#define REBUILD_FIELD_SWITCH_CASE( \
|
||||
defaults, rawValue, property, field, fieldName) \
|
||||
case CONSTEXPR_RAW_PROPS_KEY_HASH(fieldName): { \
|
||||
if (rawValue.hasValue()) { \
|
||||
decltype(defaults.field) res; \
|
||||
fromRawValue(context, rawValue, res); \
|
||||
property.field = res; \
|
||||
} else { \
|
||||
property.field = defaults.field; \
|
||||
} \
|
||||
return; \
|
||||
}
|
||||
|
||||
namespace facebook {
|
||||
|
||||
Reference in New Issue
Block a user