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