Fabric: Implementing cloneAndReplaceChild() for ViewShadowNode

Summary:
First, LayoutableShadowNode::cloneAndReplaceChild() is now pure virtual. The default implementation was useless and confusing.
Second, cloneAndReplaceChild() is now fully implemented for ViewShadowNode, so fancy Yoga Concurrent layout *should* work now.

Reviewed By: mdvacca

Differential Revision: D7376352

fbshipit-source-id: 1199a37e64535c8592a2a5480e60139f61d02006
This commit is contained in:
Valentin Shergin
2018-03-25 22:43:33 -07:00
committed by Facebook Github Bot
parent 8f9212b839
commit ee0cc6bbe7
4 changed files with 29 additions and 6 deletions

View File

@@ -93,9 +93,5 @@ void LayoutableShadowNode::layoutChildren(LayoutContext layoutContext) {
// Default implementation does nothing.
}
SharedLayoutableShadowNode LayoutableShadowNode::cloneAndReplaceChild(const SharedLayoutableShadowNode &child) {
return child;
}
} // namespace react
} // namespace facebook

View File

@@ -93,9 +93,8 @@ protected:
/*
* In case layout algorithm needs to mutate this (probably sealed) node,
* it has to clone and replace it in the hierarchy before to do so.
* Default implementation does nothing and returns `child`.
*/
virtual SharedLayoutableShadowNode cloneAndReplaceChild(const SharedLayoutableShadowNode &child);
virtual SharedLayoutableShadowNode cloneAndReplaceChild(const SharedLayoutableShadowNode &child) = 0;
/*
* Sets layout metrics for the shadow node.