Warn when height/width is set in style without correct flex
Reviewed By: emilsjolander, yungsters Differential Revision: D4095399 fbshipit-source-id: 6246e47a39ebbc60835bc1ce5e9fb78c6630a851
This commit is contained in:
parent
45275e30b9
commit
a96b4ab5a0
|
@ -142,6 +142,16 @@ DEFINE_PROCESS_META_PROPS(Border);
|
|||
}
|
||||
CSSNodeSetHasNewLayout(node, false);
|
||||
|
||||
#if RCT_DEBUG
|
||||
// This works around a breaking change in css-layout where setting flexBasis needs to be set explicitly, instead of relying on flex to propagate.
|
||||
// We check for it by seeing if a width/height is provided along with a flexBasis of 0 and the width/height is laid out as 0.
|
||||
if ((!CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(node)) && CSSNodeStyleGetFlexBasis(node) == 0) &&
|
||||
((!CSSValueIsUndefined(CSSNodeStyleGetWidth(node)) && CSSNodeStyleGetWidth(node) > 0 && CSSNodeLayoutGetWidth(node) == 0) ||
|
||||
(!CSSValueIsUndefined(CSSNodeStyleGetHeight(node)) && CSSNodeStyleGetHeight(node) > 0 && CSSNodeLayoutGetHeight(node) == 0))) {
|
||||
RCTLogError(@"View was rendered with explicitly set width/height but with a 0 flexBasis. (This might be fixed by changing flex: to flexGrow:) View: %@", self);
|
||||
}
|
||||
#endif
|
||||
|
||||
CGPoint absoluteTopLeft = {
|
||||
absolutePosition.x + CSSNodeLayoutGetLeft(node),
|
||||
absolutePosition.y + CSSNodeLayoutGetTop(node)
|
||||
|
|
Loading…
Reference in New Issue