From 6e262624fcb3ccea694f47b9b3474aabdeaed29f Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 18:22:02 -0700 Subject: [PATCH] Migrate YogaWrap enum to Kotlin (#56793) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: X-link: https://github.com/facebook/yoga/pull/1949 Pull Request resolved: https://github.com/facebook/react-native/pull/56793 Migrate YogaWrap.java to YogaWrap.kt by adding Wrap to KOTLIN_ENUM_NAMES in enums.py and regenerating. All enums are now migrated to Kotlin — KOTLIN_ENUM_NAMES now contains all enum names. Reviewed By: fabriziocucci Differential Revision: D104666339 fbshipit-source-id: c30cac3d1f8cd5d8ac863c961ad7c90f4371cc58 --- .../main/java/com/facebook/yoga/YogaWrap.java | 35 ------------------- .../main/java/com/facebook/yoga/YogaWrap.kt | 29 +++++++++++++++ 2 files changed, 29 insertions(+), 35 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.java deleted file mode 100644 index cf87e9ef5ec..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.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 YogaWrap { - NO_WRAP(0), - WRAP(1), - WRAP_REVERSE(2); - - private final int mIntValue; - - YogaWrap(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaWrap fromInt(int value) { - switch (value) { - case 0: return NO_WRAP; - case 1: return WRAP; - case 2: return WRAP_REVERSE; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.kt new file mode 100644 index 00000000000..31e20f2aec1 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.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 YogaWrap(public val intValue: Int) { + NO_WRAP(0), + WRAP(1), + WRAP_REVERSE(2); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaWrap = + when (value) { + 0 -> NO_WRAP + 1 -> WRAP + 2 -> WRAP_REVERSE + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +}