Implement method bindings for gap/row-gap/column-gap

Summary:
This adds method bindings for `YGNodeStyleSetGap` and `YGNodeStyleGetGap`.

Changelog:
[Genral][Added] - Implement method bindings for yoga gap/row-gap/column-gap

Reviewed By: yungsters

Differential Revision: D39922411

fbshipit-source-id: 6cbb4d352203d2ec92df162c3f2f2efd02bd9568
This commit is contained in:
Nick Gerleman
2022-10-13 08:18:49 -07:00
committed by Facebook GitHub Bot
parent 582533dbc6
commit f992e63ac5
13 changed files with 111 additions and 1 deletions

View File

@@ -734,6 +734,27 @@ static jlong jni_YGNodeCloneJNI(JNIEnv* env, jobject obj, jlong nativePointer) {
return reinterpret_cast<jlong>(clonedYogaNode);
}
static jfloat jni_YGNodeStyleGetGapJNI(
JNIEnv* env,
jobject obj,
jlong nativePointer,
jint gutter) {
return (jfloat) YGNodeStyleGetGap(
_jlong2YGNodeRef(nativePointer), static_cast<YGGutter>(gutter));
}
static void jni_YGNodeStyleSetGapJNI(
JNIEnv* env,
jobject obj,
jlong nativePointer,
jint gutter,
jfloat gapLength) {
YGNodeStyleSetGap(
_jlong2YGNodeRef(nativePointer),
static_cast<YGGutter>(gutter),
static_cast<float>(gapLength));
}
// Yoga specific properties, not compatible with flexbox specification
YG_NODE_JNI_STYLE_PROP(jfloat, float, AspectRatio);
@@ -971,6 +992,8 @@ static JNINativeMethod methods[] = {
{"jni_YGNodeSetHasMeasureFuncJNI",
"(JZ)V",
(void*) jni_YGNodeSetHasMeasureFuncJNI},
{"jni_YGNodeStyleGetGapJNI", "(JI)F", (void*) jni_YGNodeStyleGetGapJNI},
{"jni_YGNodeStyleSetGapJNI", "(JIF)V", (void*) jni_YGNodeStyleSetGapJNI},
{"jni_YGNodeSetHasBaselineFuncJNI",
"(JZ)V",
(void*) jni_YGNodeSetHasBaselineFuncJNI},