From b7801f29c50b5c71ab0e516e23d652b30f82c656 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 10:15:10 -0700 Subject: [PATCH] Migrate YogaMeasureMode enum to Kotlin (#56785) Summary: X-link: https://github.com/facebook/yoga/pull/1958 Pull Request resolved: https://github.com/facebook/react-native/pull/56785 Migrate YogaMeasureMode.java to YogaMeasureMode.kt by adding MeasureMode to KOTLIN_ENUM_NAMES in enums.py and regenerating. Reviewed By: fabriziocucci Differential Revision: D104666333 fbshipit-source-id: 649ecf9a670153026e08c54ee45baa6e4a16dd93 --- .../com/facebook/yoga/YogaMeasureMode.java | 35 ------------------- .../java/com/facebook/yoga/YogaMeasureMode.kt | 29 +++++++++++++++ 2 files changed, 29 insertions(+), 35 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.java deleted file mode 100644 index 0c77c23897e..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.java +++ /dev/null @@ -1,35 +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 YogaMeasureMode { - UNDEFINED(0), - EXACTLY(1), - AT_MOST(2); - - private final int mIntValue; - - YogaMeasureMode(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaMeasureMode fromInt(int value) { - switch (value) { - case 0: return UNDEFINED; - case 1: return EXACTLY; - case 2: return AT_MOST; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.kt new file mode 100644 index 00000000000..1a41cc6eeca --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.kt @@ -0,0 +1,29 @@ +/* + * 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 YogaMeasureMode(public val intValue: Int) { + UNDEFINED(0), + EXACTLY(1), + AT_MOST(2); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaMeasureMode = + when (value) { + 0 -> UNDEFINED + 1 -> EXACTLY + 2 -> AT_MOST + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +}