Skip to content

Commit cf58940

Browse files
committed
Move trait setting to updateYogaProps
1 parent 0d193a3 commit cf58940

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ YogaLayoutableShadowNode::YogaLayoutableShadowNode(
8989
updateYogaProps();
9090
updateYogaChildren();
9191

92-
initialize();
9392
ensureConsistency();
9493
}
9594

@@ -159,18 +158,9 @@ YogaLayoutableShadowNode::YogaLayoutableShadowNode(
159158
updateYogaChildren();
160159
}
161160

162-
initialize();
163161
ensureConsistency();
164162
}
165163

166-
void YogaLayoutableShadowNode::initialize() {
167-
if (yogaNode_.style().display() == yoga::Display::Contents) {
168-
ShadowNode::traits_.set(ShadowNodeTraits::ForceFlattenView);
169-
} else {
170-
ShadowNode::traits_.unset(ShadowNodeTraits::ForceFlattenView);
171-
}
172-
}
173-
174164
void YogaLayoutableShadowNode::cleanLayout() {
175165
yogaNode_.setDirty(false);
176166
}
@@ -398,6 +388,12 @@ void YogaLayoutableShadowNode::updateYogaProps() {
398388
!viewProps.filter.empty();
399389
YGNodeSetAlwaysFormsContainingBlock(&yogaNode_, alwaysFormsContainingBlock);
400390
}
391+
392+
if (yogaNode_.style().display() == yoga::Display::Contents) {
393+
ShadowNode::traits_.set(ShadowNodeTraits::ForceFlattenView);
394+
} else {
395+
ShadowNode::traits_.unset(ShadowNodeTraits::ForceFlattenView);
396+
}
401397
}
402398

403399
/*static*/ yoga::Style YogaLayoutableShadowNode::applyAliasedProps(

packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ class YogaLayoutableShadowNode : public LayoutableShadowNode {
101101
mutable yoga::Node yogaNode_;
102102

103103
private:
104-
/*
105-
* Sets initial traits on the node.
106-
*/
107-
void initialize();
108-
109104
/*
110105
* Goes over `yogaNode_.getChildren()` and in case child's owner is
111106
* equal to address of `yogaNode_`, it sets child's owner address

0 commit comments

Comments
 (0)