From f1b488f5dae2727472bedc9b65d901dbf20f20d5 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 07:48:48 -0700 Subject: [PATCH] Migrate YogaGridTrackType enum to Kotlin (#56786) Summary: X-link: https://github.com/facebook/yoga/pull/1952 Pull Request resolved: https://github.com/facebook/react-native/pull/56786 Migrate YogaGridTrackType.java to YogaGridTrackType.kt by adding GridTrackType to KOTLIN_ENUM_NAMES in enums.py and regenerating. Reviewed By: fabriziocucci Differential Revision: D104666336 fbshipit-source-id: 4b2966b14f09bfce9a64854bbfe161b7849195a8 --- .../com/facebook/yoga/YogaGridTrackType.java | 39 ------------------- .../com/facebook/yoga/YogaGridTrackType.kt | 33 ++++++++++++++++ 2 files changed, 33 insertions(+), 39 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.java deleted file mode 100644 index e3d22d25be3..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// @generated by enums.py - -package com.facebook.yoga; - -public enum YogaGridTrackType { - AUTO(0), - POINTS(1), - PERCENT(2), - FR(3), - MINMAX(4); - - private final int mIntValue; - - YogaGridTrackType(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaGridTrackType fromInt(int value) { - switch (value) { - case 0: return AUTO; - case 1: return POINTS; - case 2: return PERCENT; - case 3: return FR; - case 4: return MINMAX; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.kt new file mode 100644 index 00000000000..61dc6155903 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.kt @@ -0,0 +1,33 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// @generated by enums.py + +package com.facebook.yoga + +public enum class YogaGridTrackType(public val intValue: Int) { + AUTO(0), + POINTS(1), + PERCENT(2), + FR(3), + MINMAX(4); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaGridTrackType = + when (value) { + 0 -> AUTO + 1 -> POINTS + 2 -> PERCENT + 3 -> FR + 4 -> MINMAX + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +}