Skip to content

Commit

Permalink
Add back deprecated getParent methods for non-breaking API change (#775)
Browse files Browse the repository at this point in the history
Summary:
I'm not totally sure what I'm doing so if this needs changes let me know.
Closes facebook/yoga#775

Reviewed By: emilsjolander

Differential Revision: D8331892

Pulled By: passy

fbshipit-source-id: eb1023e666322d2472e4081fd4a4e72a7b43d049
  • Loading branch information
vinc3m1 authored and facebook-github-bot committed Jun 11, 2018
1 parent 4aeefa5 commit c3c5c3c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,14 @@ public YogaNode removeChildAt(int i) {
* {@link YogaNode} is shared between two or more YogaTrees.
*/
@Nullable
public
YogaNode getOwner() {
public YogaNode getOwner() {
return mOwner;
}

/** @deprecated Use #getOwner() instead. This will be removed in the next version. */
@Deprecated
@Nullable
YogaNode getParent() {
public YogaNode getParent() {
return getOwner();
}

Expand Down
4 changes: 4 additions & 0 deletions ReactCommon/yoga/yoga/YGNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ YGNodeRef YGNode::getOwner() const {
return owner_;
}

YGNodeRef YGNode::getParent() const {
return getOwner();
}

YGVector YGNode::getChildren() const {
return children_;
}
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/yoga/yoga/YGNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ struct YGNode {
// to one YogaTree or nullptr when the YGNode is shared between two or more
// YogaTrees.
YGNodeRef getOwner() const;
// Deprecated, use getOwner() instead.
YGNodeRef getParent() const;
YGVector getChildren() const;
uint32_t getChildrenCount() const;
YGNodeRef getChild(uint32_t index) const;
Expand Down
4 changes: 4 additions & 0 deletions ReactCommon/yoga/yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,10 @@ YGNodeRef YGNodeGetOwner(const YGNodeRef node) {
return node->getOwner();
}

YGNodeRef YGNodeGetParent(const YGNodeRef node) {
return node->getOwner();
}

void YGNodeMarkDirty(const YGNodeRef node) {
YGAssertWithNode(
node,
Expand Down
1 change: 1 addition & 0 deletions ReactCommon/yoga/yoga/Yoga.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child);
WIN_EXPORT void YGNodeRemoveAllChildren(const YGNodeRef node);
WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index);
WIN_EXPORT YGNodeRef YGNodeGetOwner(const YGNodeRef node);
WIN_EXPORT YGNodeRef YGNodeGetParent(const YGNodeRef node);
WIN_EXPORT uint32_t YGNodeGetChildCount(const YGNodeRef node);
WIN_EXPORT void YGNodeSetChildren(
YGNodeRef const owner,
Expand Down

0 comments on commit c3c5c3c

Please sign in to comment.