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