From 346435ab94877085ef5506932ee40414819df12f Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 01/13] Migrate YogaAlign enum to Kotlin Summary: Migrate YogaAlign.java to YogaAlign.kt by adding Align to KOTLIN_ENUM_NAMES in enums.py and regenerating. Changelog: [Internal] - Differential Revision: D104666334 --- .../java/com/facebook/yoga/YogaAlign.java | 51 ------------------- .../main/java/com/facebook/yoga/YogaAlign.kt | 45 ++++++++++++++++ 2 files changed, 45 insertions(+), 51 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.java deleted file mode 100644 index 6f1c4565818c..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.java +++ /dev/null @@ -1,51 +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 YogaAlign { - AUTO(0), - FLEX_START(1), - CENTER(2), - FLEX_END(3), - STRETCH(4), - BASELINE(5), - SPACE_BETWEEN(6), - SPACE_AROUND(7), - SPACE_EVENLY(8), - START(9), - END(10); - - private final int mIntValue; - - YogaAlign(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaAlign fromInt(int value) { - switch (value) { - case 0: return AUTO; - case 1: return FLEX_START; - case 2: return CENTER; - case 3: return FLEX_END; - case 4: return STRETCH; - case 5: return BASELINE; - case 6: return SPACE_BETWEEN; - case 7: return SPACE_AROUND; - case 8: return SPACE_EVENLY; - case 9: return START; - case 10: return END; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.kt new file mode 100644 index 000000000000..e8fa92d454e4 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.kt @@ -0,0 +1,45 @@ +/* + * 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 YogaAlign(public val intValue: Int) { + AUTO(0), + FLEX_START(1), + CENTER(2), + FLEX_END(3), + STRETCH(4), + BASELINE(5), + SPACE_BETWEEN(6), + SPACE_AROUND(7), + SPACE_EVENLY(8), + START(9), + END(10); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaAlign = + when (value) { + 0 -> AUTO + 1 -> FLEX_START + 2 -> CENTER + 3 -> FLEX_END + 4 -> STRETCH + 5 -> BASELINE + 6 -> SPACE_BETWEEN + 7 -> SPACE_AROUND + 8 -> SPACE_EVENLY + 9 -> START + 10 -> END + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +} From 55d67f9ba06e07d1c425ce152b3500a4c01c7cb5 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 02/13] Migrate YogaBoxSizing enum to Kotlin Summary: Migrate YogaBoxSizing.java to YogaBoxSizing.kt by adding BoxSizing to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666350 --- .../java/com/facebook/yoga/YogaBoxSizing.java | 33 ------------------- .../java/com/facebook/yoga/YogaBoxSizing.kt | 27 +++++++++++++++ 2 files changed, 27 insertions(+), 33 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.java deleted file mode 100644 index fcd25f55ddc0..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.java +++ /dev/null @@ -1,33 +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 YogaBoxSizing { - BORDER_BOX(0), - CONTENT_BOX(1); - - private final int mIntValue; - - YogaBoxSizing(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaBoxSizing fromInt(int value) { - switch (value) { - case 0: return BORDER_BOX; - case 1: return CONTENT_BOX; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.kt new file mode 100644 index 000000000000..c7d055fc7f95 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.kt @@ -0,0 +1,27 @@ +/* + * 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 YogaBoxSizing(public val intValue: Int) { + BORDER_BOX(0), + CONTENT_BOX(1); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaBoxSizing = + when (value) { + 0 -> BORDER_BOX + 1 -> CONTENT_BOX + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +} From ab0e0fb233368a0d5f2142507fe5ece4e5d03c63 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 03/13] Migrate YogaDimension enum to Kotlin Summary: Migrate YogaDimension.java to YogaDimension.kt by adding Dimension to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666342 --- .../java/com/facebook/yoga/YogaDimension.java | 33 ------------------- .../java/com/facebook/yoga/YogaDimension.kt | 27 +++++++++++++++ 2 files changed, 27 insertions(+), 33 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.java deleted file mode 100644 index a949ddc3ce1c..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.java +++ /dev/null @@ -1,33 +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 YogaDimension { - WIDTH(0), - HEIGHT(1); - - private final int mIntValue; - - YogaDimension(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaDimension fromInt(int value) { - switch (value) { - case 0: return WIDTH; - case 1: return HEIGHT; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.kt new file mode 100644 index 000000000000..132cc2929307 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.kt @@ -0,0 +1,27 @@ +/* + * 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 YogaDimension(public val intValue: Int) { + WIDTH(0), + HEIGHT(1); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaDimension = + when (value) { + 0 -> WIDTH + 1 -> HEIGHT + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +} From 37232bad20c6aca7bf7a183d2bd5005fff194127 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 04/13] Migrate YogaDisplay enum to Kotlin Summary: Migrate YogaDisplay.java to YogaDisplay.kt by adding Display to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666346 --- .../java/com/facebook/yoga/YogaDisplay.java | 37 ------------------- .../java/com/facebook/yoga/YogaDisplay.kt | 31 ++++++++++++++++ 2 files changed, 31 insertions(+), 37 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.java deleted file mode 100644 index 8e7e0f83cd9c..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.java +++ /dev/null @@ -1,37 +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 YogaDisplay { - FLEX(0), - NONE(1), - CONTENTS(2), - GRID(3); - - private final int mIntValue; - - YogaDisplay(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaDisplay fromInt(int value) { - switch (value) { - case 0: return FLEX; - case 1: return NONE; - case 2: return CONTENTS; - case 3: return GRID; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.kt new file mode 100644 index 000000000000..6a56a048bbde --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.kt @@ -0,0 +1,31 @@ +/* + * 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 YogaDisplay(public val intValue: Int) { + FLEX(0), + NONE(1), + CONTENTS(2), + GRID(3); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaDisplay = + when (value) { + 0 -> FLEX + 1 -> NONE + 2 -> CONTENTS + 3 -> GRID + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +} From ca526ebdf0c6598c98ac0345b439e89b839c7413 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 05/13] Migrate YogaEdge enum to Kotlin Summary: Migrate YogaEdge.java to YogaEdge.kt by adding Edge to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666351 --- .../main/java/com/facebook/yoga/YogaEdge.java | 47 ------------------- .../main/java/com/facebook/yoga/YogaEdge.kt | 41 ++++++++++++++++ 2 files changed, 41 insertions(+), 47 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.java deleted file mode 100644 index 6b915348230d..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.java +++ /dev/null @@ -1,47 +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 YogaEdge { - LEFT(0), - TOP(1), - RIGHT(2), - BOTTOM(3), - START(4), - END(5), - HORIZONTAL(6), - VERTICAL(7), - ALL(8); - - private final int mIntValue; - - YogaEdge(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaEdge fromInt(int value) { - switch (value) { - case 0: return LEFT; - case 1: return TOP; - case 2: return RIGHT; - case 3: return BOTTOM; - case 4: return START; - case 5: return END; - case 6: return HORIZONTAL; - case 7: return VERTICAL; - case 8: return ALL; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.kt new file mode 100644 index 000000000000..0ab62ebbf3b4 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.kt @@ -0,0 +1,41 @@ +/* + * 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 YogaEdge(public val intValue: Int) { + LEFT(0), + TOP(1), + RIGHT(2), + BOTTOM(3), + START(4), + END(5), + HORIZONTAL(6), + VERTICAL(7), + ALL(8); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaEdge = + when (value) { + 0 -> LEFT + 1 -> TOP + 2 -> RIGHT + 3 -> BOTTOM + 4 -> START + 5 -> END + 6 -> HORIZONTAL + 7 -> VERTICAL + 8 -> ALL + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +} From 28d8f23c8aa66c69e9ed4c668f41e8b6159fdc21 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 06/13] Migrate YogaErrata enum to Kotlin Summary: Migrate YogaErrata.java to YogaErrata.kt by adding Errata to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666332 --- .../java/com/facebook/yoga/YogaErrata.java | 41 ------------------- .../main/java/com/facebook/yoga/YogaErrata.kt | 35 ++++++++++++++++ 2 files changed, 35 insertions(+), 41 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.java deleted file mode 100644 index e0521b3fbb52..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.java +++ /dev/null @@ -1,41 +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 YogaErrata { - NONE(0), - STRETCH_FLEX_BASIS(1), - ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING(2), - ABSOLUTE_PERCENT_AGAINST_INNER_SIZE(4), - ALL(2147483647), - CLASSIC(2147483646); - - private final int mIntValue; - - YogaErrata(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaErrata fromInt(int value) { - switch (value) { - case 0: return NONE; - case 1: return STRETCH_FLEX_BASIS; - case 2: return ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING; - case 4: return ABSOLUTE_PERCENT_AGAINST_INNER_SIZE; - case 2147483647: return ALL; - case 2147483646: return CLASSIC; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.kt new file mode 100644 index 000000000000..940f2861e1d3 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.kt @@ -0,0 +1,35 @@ +/* + * 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 YogaErrata(public val intValue: Int) { + NONE(0), + STRETCH_FLEX_BASIS(1), + ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING(2), + ABSOLUTE_PERCENT_AGAINST_INNER_SIZE(4), + ALL(2147483647), + CLASSIC(2147483646); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaErrata = + when (value) { + 0 -> NONE + 1 -> STRETCH_FLEX_BASIS + 2 -> ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING + 4 -> ABSOLUTE_PERCENT_AGAINST_INNER_SIZE + 2147483647 -> ALL + 2147483646 -> CLASSIC + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +} From 0fd5ff3d363f4c5ce6fdf119c0951e075ad31179 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 07/13] Migrate YogaExperimentalFeature enum to Kotlin Summary: Migrate YogaExperimentalFeature.java to YogaExperimentalFeature.kt by adding ExperimentalFeature to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666330 --- .../yoga/YogaExperimentalFeature.java | 33 ------------------- .../facebook/yoga/YogaExperimentalFeature.kt | 27 +++++++++++++++ 2 files changed, 27 insertions(+), 33 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java deleted file mode 100644 index 32e643439e3d..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java +++ /dev/null @@ -1,33 +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 YogaExperimentalFeature { - WEB_FLEX_BASIS(0), - FIX_FLEX_BASIS_FIT_CONTENT(1); - - private final int mIntValue; - - YogaExperimentalFeature(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaExperimentalFeature fromInt(int value) { - switch (value) { - case 0: return WEB_FLEX_BASIS; - case 1: return FIX_FLEX_BASIS_FIT_CONTENT; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.kt new file mode 100644 index 000000000000..aec70ac24698 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.kt @@ -0,0 +1,27 @@ +/* + * 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 YogaExperimentalFeature(public val intValue: Int) { + WEB_FLEX_BASIS(0), + FIX_FLEX_BASIS_FIT_CONTENT(1); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaExperimentalFeature = + when (value) { + 0 -> WEB_FLEX_BASIS + 1 -> FIX_FLEX_BASIS_FIT_CONTENT + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +} From bebc0c8dcdb4deefc128bde0b7c3c8574cc6dbee Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 08/13] Migrate YogaFlexDirection enum to Kotlin Summary: Migrate YogaFlexDirection.java to YogaFlexDirection.kt by adding FlexDirection to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666341 --- .../com/facebook/yoga/YogaFlexDirection.java | 37 ------------------- .../com/facebook/yoga/YogaFlexDirection.kt | 31 ++++++++++++++++ 2 files changed, 31 insertions(+), 37 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.java deleted file mode 100644 index 719888a1864e..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.java +++ /dev/null @@ -1,37 +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 YogaFlexDirection { - COLUMN(0), - COLUMN_REVERSE(1), - ROW(2), - ROW_REVERSE(3); - - private final int mIntValue; - - YogaFlexDirection(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaFlexDirection fromInt(int value) { - switch (value) { - case 0: return COLUMN; - case 1: return COLUMN_REVERSE; - case 2: return ROW; - case 3: return ROW_REVERSE; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.kt new file mode 100644 index 000000000000..d9ed0e32862e --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.kt @@ -0,0 +1,31 @@ +/* + * 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 YogaFlexDirection(public val intValue: Int) { + COLUMN(0), + COLUMN_REVERSE(1), + ROW(2), + ROW_REVERSE(3); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaFlexDirection = + when (value) { + 0 -> COLUMN + 1 -> COLUMN_REVERSE + 2 -> ROW + 3 -> ROW_REVERSE + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +} From 1a774d27c756b0c9623e2efcc4554be193f65ad6 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 09/13] Migrate YogaGridTrackType enum to Kotlin Summary: Migrate YogaGridTrackType.java to YogaGridTrackType.kt by adding GridTrackType to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666336 --- .../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 e3d22d25be3f..000000000000 --- 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 000000000000..61dc61559033 --- /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") + } + } +} From 2da39e358d52727cc74026477383f47a1c048e12 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 10/13] Migrate YogaGutter enum to Kotlin Summary: Migrate YogaGutter.java to YogaGutter.kt by adding Gutter to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666345 --- .../java/com/facebook/yoga/YogaGutter.java | 35 ------------------- .../main/java/com/facebook/yoga/YogaGutter.kt | 29 +++++++++++++++ 2 files changed, 29 insertions(+), 35 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.java deleted file mode 100644 index 2b4be1c08d98..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.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 YogaGutter { - COLUMN(0), - ROW(1), - ALL(2); - - private final int mIntValue; - - YogaGutter(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaGutter fromInt(int value) { - switch (value) { - case 0: return COLUMN; - case 1: return ROW; - case 2: return ALL; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.kt new file mode 100644 index 000000000000..873423a589c3 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.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 YogaGutter(public val intValue: Int) { + COLUMN(0), + ROW(1), + ALL(2); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaGutter = + when (value) { + 0 -> COLUMN + 1 -> ROW + 2 -> ALL + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +} From 04e591df8ffd72c26c5f84dad8ac827f9bebed5d Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 11/13] Migrate YogaJustify enum to Kotlin Summary: Migrate YogaJustify.java to YogaJustify.kt by adding Justify to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666331 --- .../java/com/facebook/yoga/YogaJustify.java | 49 ------------------- .../java/com/facebook/yoga/YogaJustify.kt | 43 ++++++++++++++++ 2 files changed, 43 insertions(+), 49 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java deleted file mode 100644 index 778238ec6636..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java +++ /dev/null @@ -1,49 +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 YogaJustify { - AUTO(0), - FLEX_START(1), - CENTER(2), - FLEX_END(3), - SPACE_BETWEEN(4), - SPACE_AROUND(5), - SPACE_EVENLY(6), - STRETCH(7), - START(8), - END(9); - - private final int mIntValue; - - YogaJustify(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaJustify fromInt(int value) { - switch (value) { - case 0: return AUTO; - case 1: return FLEX_START; - case 2: return CENTER; - case 3: return FLEX_END; - case 4: return SPACE_BETWEEN; - case 5: return SPACE_AROUND; - case 6: return SPACE_EVENLY; - case 7: return STRETCH; - case 8: return START; - case 9: return END; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.kt new file mode 100644 index 000000000000..731b034ef264 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.kt @@ -0,0 +1,43 @@ +/* + * 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 YogaJustify(public val intValue: Int) { + AUTO(0), + FLEX_START(1), + CENTER(2), + FLEX_END(3), + SPACE_BETWEEN(4), + SPACE_AROUND(5), + SPACE_EVENLY(6), + STRETCH(7), + START(8), + END(9); + + public fun intValue(): Int = intValue + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaJustify = + when (value) { + 0 -> AUTO + 1 -> FLEX_START + 2 -> CENTER + 3 -> FLEX_END + 4 -> SPACE_BETWEEN + 5 -> SPACE_AROUND + 6 -> SPACE_EVENLY + 7 -> STRETCH + 8 -> START + 9 -> END + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +} From fb574b96e4ab6ffff6bd6f696032224f04f8e996 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:42:25 -0700 Subject: [PATCH 12/13] Migrate YogaLogLevel enum to Kotlin Summary: Migrate YogaLogLevel.java to YogaLogLevel.kt by adding LogLevel to KOTLIN_ENUM_NAMES in enums.py and regenerating. Also adds DO_NOT_STRIP support to the Kotlin codegen path to preserve the DoNotStrip annotation. Differential Revision: D104666343 --- .../java/com/facebook/yoga/YogaLogLevel.java | 45 ------------------- .../java/com/facebook/yoga/YogaLogLevel.kt | 39 ++++++++++++++++ 2 files changed, 39 insertions(+), 45 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.kt diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java deleted file mode 100644 index 761f302eb29d..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java +++ /dev/null @@ -1,45 +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; - -import com.facebook.yoga.annotations.DoNotStrip; - -@DoNotStrip -public enum YogaLogLevel { - ERROR(0), - WARN(1), - INFO(2), - DEBUG(3), - VERBOSE(4), - FATAL(5); - - private final int mIntValue; - - YogaLogLevel(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - @DoNotStrip - public static YogaLogLevel fromInt(int value) { - switch (value) { - case 0: return ERROR; - case 1: return WARN; - case 2: return INFO; - case 3: return DEBUG; - case 4: return VERBOSE; - case 5: return FATAL; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.kt new file mode 100644 index 000000000000..a8ff53fdd930 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.kt @@ -0,0 +1,39 @@ +/* + * 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 + +import com.facebook.yoga.annotations.DoNotStrip + +@DoNotStrip +public enum class YogaLogLevel(public val intValue: Int) { + ERROR(0), + WARN(1), + INFO(2), + DEBUG(3), + VERBOSE(4), + FATAL(5); + + public fun intValue(): Int = intValue + + public companion object { + @DoNotStrip + @JvmStatic + public fun fromInt(value: Int): YogaLogLevel = + when (value) { + 0 -> ERROR + 1 -> WARN + 2 -> INFO + 3 -> DEBUG + 4 -> VERBOSE + 5 -> FATAL + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +} From 2b2906712a2056b6eb083bed4b54534347c3cdbe Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 12 May 2026 05:48:06 -0700 Subject: [PATCH 13/13] Migrate YogaMeasureMode enum to Kotlin Summary: Migrate YogaMeasureMode.java to YogaMeasureMode.kt by adding MeasureMode to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666333 --- .../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 0c77c23897e7..000000000000 --- 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 000000000000..1a41cc6eecaf --- /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") + } + } +}