Skip to content

Commit c3c5c3c

Browse files
vinc3m1facebook-github-bot
authored andcommitted
Add back deprecated getParent methods for non-breaking API change (#775)
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
1 parent 4aeefa5 commit c3c5c3c

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,14 @@ public YogaNode removeChildAt(int i) {
234234
* {@link YogaNode} is shared between two or more YogaTrees.
235235
*/
236236
@Nullable
237-
public
238-
YogaNode getOwner() {
237+
public YogaNode getOwner() {
239238
return mOwner;
240239
}
241240

242241
/** @deprecated Use #getOwner() instead. This will be removed in the next version. */
243242
@Deprecated
244243
@Nullable
245-
YogaNode getParent() {
244+
public YogaNode getParent() {
246245
return getOwner();
247246
}
248247

ReactCommon/yoga/yoga/YGNode.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ YGNodeRef YGNode::getOwner() const {
5353
return owner_;
5454
}
5555

56+
YGNodeRef YGNode::getParent() const {
57+
return getOwner();
58+
}
59+
5660
YGVector YGNode::getChildren() const {
5761
return children_;
5862
}

ReactCommon/yoga/yoga/YGNode.h

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ struct YGNode {
7878
// to one YogaTree or nullptr when the YGNode is shared between two or more
7979
// YogaTrees.
8080
YGNodeRef getOwner() const;
81+
// Deprecated, use getOwner() instead.
82+
YGNodeRef getParent() const;
8183
YGVector getChildren() const;
8284
uint32_t getChildrenCount() const;
8385
YGNodeRef getChild(uint32_t index) const;

ReactCommon/yoga/yoga/Yoga.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,10 @@ YGNodeRef YGNodeGetOwner(const YGNodeRef node) {
535535
return node->getOwner();
536536
}
537537

538+
YGNodeRef YGNodeGetParent(const YGNodeRef node) {
539+
return node->getOwner();
540+
}
541+
538542
void YGNodeMarkDirty(const YGNodeRef node) {
539543
YGAssertWithNode(
540544
node,

ReactCommon/yoga/yoga/Yoga.h

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child);
9292
WIN_EXPORT void YGNodeRemoveAllChildren(const YGNodeRef node);
9393
WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index);
9494
WIN_EXPORT YGNodeRef YGNodeGetOwner(const YGNodeRef node);
95+
WIN_EXPORT YGNodeRef YGNodeGetParent(const YGNodeRef node);
9596
WIN_EXPORT uint32_t YGNodeGetChildCount(const YGNodeRef node);
9697
WIN_EXPORT void YGNodeSetChildren(
9798
YGNodeRef const owner,

0 commit comments

Comments
 (0)