mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove alias props for inset, insetInline, insetBlock (#41612)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41612 We never use the position edges for Yoga style. We should not keep extra props, and instead just parse directly into the Yoga style. Previously included in D50998164 Changelog: [Internal] Reviewed By: joevilches Differential Revision: D51508217 fbshipit-source-id: ff28cf7168446068b10901fbba258414b561f07f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c9c5651108
commit
d09b7b0382
-9
@@ -391,15 +391,6 @@ void YogaLayoutableShadowNode::updateYogaProps() {
|
||||
yoga::Style result{baseStyle};
|
||||
|
||||
// Aliases with precedence
|
||||
if (!props.inset.isUndefined()) {
|
||||
result.position()[YGEdgeAll] = props.inset;
|
||||
}
|
||||
if (!props.insetBlock.isUndefined()) {
|
||||
result.position()[YGEdgeVertical] = props.insetBlock;
|
||||
}
|
||||
if (!props.insetInline.isUndefined()) {
|
||||
result.position()[YGEdgeHorizontal] = props.insetInline;
|
||||
}
|
||||
if (!props.insetInlineEnd.isUndefined()) {
|
||||
result.position()[YGEdgeEnd] = props.insetInlineEnd;
|
||||
}
|
||||
|
||||
+6
-22
@@ -227,7 +227,12 @@ static inline T const getFieldValue(
|
||||
REBUILD_YG_FIELD_SWITCH_CASE_INDEXED(position, YGEdgeRight, "right"); \
|
||||
REBUILD_YG_FIELD_SWITCH_CASE_INDEXED(position, YGEdgeBottom, "bottom"); \
|
||||
REBUILD_YG_FIELD_SWITCH_CASE_INDEXED(position, YGEdgeStart, "start"); \
|
||||
REBUILD_YG_FIELD_SWITCH_CASE_INDEXED(position, YGEdgeEnd, "end");
|
||||
REBUILD_YG_FIELD_SWITCH_CASE_INDEXED(position, YGEdgeEnd, "end"); \
|
||||
REBUILD_YG_FIELD_SWITCH_CASE_INDEXED( \
|
||||
position, YGEdgeHorizontal, "insetInline"); \
|
||||
REBUILD_YG_FIELD_SWITCH_CASE_INDEXED( \
|
||||
position, YGEdgeVertical, "insetBlock"); \
|
||||
REBUILD_YG_FIELD_SWITCH_CASE_INDEXED(position, YGEdgeAll, "inset");
|
||||
|
||||
void YogaStylableProps::setProp(
|
||||
const PropsParserContext& context,
|
||||
@@ -267,11 +272,8 @@ void YogaStylableProps::setProp(
|
||||
REBUILD_FIELD_YG_EDGES(border, "border", "Width");
|
||||
|
||||
// Aliases
|
||||
RAW_SET_PROP_SWITCH_CASE(inset, "inset");
|
||||
RAW_SET_PROP_SWITCH_CASE(insetBlock, "insetBlock");
|
||||
RAW_SET_PROP_SWITCH_CASE(insetBlockEnd, "insetBlockEnd");
|
||||
RAW_SET_PROP_SWITCH_CASE(insetBlockStart, "insetBlockStart");
|
||||
RAW_SET_PROP_SWITCH_CASE(insetInline, "insetInline");
|
||||
RAW_SET_PROP_SWITCH_CASE(insetInlineEnd, "insetInlineEnd");
|
||||
RAW_SET_PROP_SWITCH_CASE(insetInlineStart, "insetInlineStart");
|
||||
RAW_SET_PROP_SWITCH_CASE(marginInline, "marginInline");
|
||||
@@ -387,18 +389,6 @@ void YogaStylableProps::convertRawPropAliases(
|
||||
const PropsParserContext& context,
|
||||
const YogaStylableProps& sourceProps,
|
||||
const RawProps& rawProps) {
|
||||
inset = convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
"inset",
|
||||
sourceProps.inset,
|
||||
CompactValue::ofUndefined());
|
||||
insetBlock = convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
"insetBlock",
|
||||
sourceProps.insetBlock,
|
||||
CompactValue::ofUndefined());
|
||||
insetBlockEnd = convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
@@ -411,12 +401,6 @@ void YogaStylableProps::convertRawPropAliases(
|
||||
"insetBlockStart",
|
||||
sourceProps.insetBlockStart,
|
||||
CompactValue::ofUndefined());
|
||||
insetInline = convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
"insetInline",
|
||||
sourceProps.insetInline,
|
||||
CompactValue::ofUndefined());
|
||||
insetInlineEnd = convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
|
||||
+2
-5
@@ -41,10 +41,8 @@ class YogaStylableProps : public Props {
|
||||
|
||||
// Duplicates of existing properties with different names, taking
|
||||
// precedence. E.g. "marginBlock" instead of "marginVertical"
|
||||
CompactValue inset;
|
||||
CompactValue insetInline;
|
||||
CompactValue insetInlineEnd;
|
||||
CompactValue insetInlineStart;
|
||||
CompactValue insetInlineEnd;
|
||||
|
||||
CompactValue marginInline;
|
||||
CompactValue marginInlineStart;
|
||||
@@ -59,9 +57,8 @@ class YogaStylableProps : public Props {
|
||||
// BlockEnd/BlockStart map to top/bottom (no writing mode), but we preserve
|
||||
// Yoga's precedence and prefer specific edges (e.g. top) to ones which are
|
||||
// flow relative (e.g. blockStart).
|
||||
CompactValue insetBlock;
|
||||
CompactValue insetBlockEnd;
|
||||
CompactValue insetBlockStart;
|
||||
CompactValue insetBlockEnd;
|
||||
|
||||
CompactValue marginBlockStart;
|
||||
CompactValue marginBlockEnd;
|
||||
|
||||
@@ -143,6 +143,24 @@ static inline yoga::Style::Edges convertRawProp(
|
||||
"end",
|
||||
sourceValue[YGEdgeEnd],
|
||||
defaultValue[YGEdgeEnd]);
|
||||
result[YGEdgeHorizontal] = convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
"insetInline",
|
||||
sourceValue[YGEdgeHorizontal],
|
||||
defaultValue[YGEdgeHorizontal]);
|
||||
result[YGEdgeVertical] = convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
"insetBlock",
|
||||
sourceValue[YGEdgeVertical],
|
||||
defaultValue[YGEdgeVertical]);
|
||||
result[YGEdgeAll] = convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
"inset",
|
||||
sourceValue[YGEdgeAll],
|
||||
defaultValue[YGEdgeAll]);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user