Pass parent with down with calculateLayout to allow percentages on root node
Reviewed By: astreet Differential Revision: D4501016 fbshipit-source-id: 0c9502e86ff200c021c78afb7ac4b48cf11b3bdb
This commit is contained in:
parent
00efe02c5b
commit
82f61b990a
|
@ -345,7 +345,7 @@ public class ReactShadowNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculateLayout() {
|
public void calculateLayout() {
|
||||||
mYogaNode.calculateLayout();
|
mYogaNode.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean hasNewLayout() {
|
public final boolean hasNewLayout() {
|
||||||
|
|
|
@ -172,10 +172,10 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||||
return mChildren == null ? -1 : mChildren.indexOf(child);
|
return mChildren == null ? -1 : mChildren.indexOf(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeCalculateLayout(long nativePointer);
|
private native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height);
|
||||||
@Override
|
@Override
|
||||||
public void calculateLayout() {
|
public void calculateLayout(float width, float height) {
|
||||||
jni_YGNodeCalculateLayout(mNativePointer);
|
jni_YGNodeCalculateLayout(mNativePointer, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native boolean jni_YGNodeHasNewLayout(long nativePointer);
|
private native boolean jni_YGNodeHasNewLayout(long nativePointer);
|
||||||
|
|
|
@ -20,7 +20,7 @@ public interface YogaNodeAPI<YogaNodeType extends YogaNodeAPI> {
|
||||||
void setMeasureFunction(YogaMeasureFunction measureFunction);
|
void setMeasureFunction(YogaMeasureFunction measureFunction);
|
||||||
void setBaselineFunction(YogaBaselineFunction measureFunction);
|
void setBaselineFunction(YogaBaselineFunction measureFunction);
|
||||||
boolean isMeasureDefined();
|
boolean isMeasureDefined();
|
||||||
void calculateLayout();
|
void calculateLayout(float width, float height);
|
||||||
boolean isDirty();
|
boolean isDirty();
|
||||||
boolean hasNewLayout();
|
boolean hasNewLayout();
|
||||||
void dirty();
|
void dirty();
|
||||||
|
|
|
@ -202,11 +202,11 @@ void jni_YGNodeRemoveChild(alias_ref<jobject>, jlong nativePointer, jlong childP
|
||||||
YGNodeRemoveChild(_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer));
|
YGNodeRemoveChild(_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
void jni_YGNodeCalculateLayout(alias_ref<jobject>, jlong nativePointer) {
|
void jni_YGNodeCalculateLayout(alias_ref<jobject>, jlong nativePointer, jfloat width, jfloat height) {
|
||||||
const YGNodeRef root = _jlong2YGNodeRef(nativePointer);
|
const YGNodeRef root = _jlong2YGNodeRef(nativePointer);
|
||||||
YGNodeCalculateLayout(root,
|
YGNodeCalculateLayout(root,
|
||||||
YGUndefined,
|
static_cast<float>(width),
|
||||||
YGUndefined,
|
static_cast<float>(height),
|
||||||
YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)));
|
YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)));
|
||||||
YGTransferLayoutOutputsRecursive(root);
|
YGTransferLayoutOutputsRecursive(root);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue