mirror of
https://github.com/status-im/react-native.git
synced 2025-02-26 16:10:58 +00:00
Don't assume a node with a measure function is a leaf node
Reviewed By: gkassabli Differential Revision: D4021096 fbshipit-source-id: 7e039239b1697a0ac42dce9f4b7e252a931bad7e
This commit is contained in:
parent
9ffe2ee0d8
commit
9a33f3f40e
@ -242,10 +242,9 @@ uint32_t CSSNodeChildCount(const CSSNodeRef node) {
|
||||
}
|
||||
|
||||
void CSSNodeMarkDirty(const CSSNodeRef node) {
|
||||
CSS_ASSERT(node->measure != NULL,
|
||||
"Nodes without custom measure functions "
|
||||
"should not manually mark themselves as "
|
||||
"dirty");
|
||||
CSS_ASSERT(node->measure != NULL || CSSNodeChildCount(node) > 0,
|
||||
"Only leaf nodes with custom measure functions"
|
||||
"should manually mark themselves as dirty");
|
||||
_CSSNodeMarkDirty(node);
|
||||
}
|
||||
|
||||
@ -966,7 +965,7 @@ static void layoutNodeImpl(const CSSNodeRef node,
|
||||
|
||||
// For content (text) nodes, determine the dimensions based on the text
|
||||
// contents.
|
||||
if (node->measure) {
|
||||
if (node->measure && CSSNodeChildCount(node) == 0) {
|
||||
const float innerWidth = availableWidth - marginAxisRow - paddingAndBorderAxisRow;
|
||||
const float innerHeight = availableHeight - marginAxisColumn - paddingAndBorderAxisColumn;
|
||||
|
||||
@ -2100,7 +2099,7 @@ bool layoutNodeInternal(const CSSNodeRef node,
|
||||
// most
|
||||
// expensive to measure, so it's worth avoiding redundant measurements if at
|
||||
// all possible.
|
||||
if (node->measure) {
|
||||
if (node->measure && CSSNodeChildCount(node) == 0) {
|
||||
const float marginAxisRow = getMarginAxis(node, CSSFlexDirectionRow);
|
||||
const float marginAxisColumn = getMarginAxis(node, CSSFlexDirectionColumn);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user