Skip to content

Commit 97cf21d

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Migrate YogaUnit enum to Kotlin (#56784)
Summary: X-link: react/yoga#1944 Pull Request resolved: #56784 Migrate YogaUnit.java to YogaUnit.kt by adding Unit to KOTLIN_ENUM_NAMES in enums.py and regenerating. Reviewed By: fabriziocucci Differential Revision: D104666347 fbshipit-source-id: 99f58b2d1cbea1592a3f4d1aa2608d42ba17e095
1 parent d181829 commit 97cf21d

2 files changed

Lines changed: 37 additions & 43 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.java

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// @generated by enums.py
9+
10+
package com.facebook.yoga
11+
12+
public enum class YogaUnit(public val intValue: Int) {
13+
UNDEFINED(0),
14+
POINT(1),
15+
PERCENT(2),
16+
AUTO(3),
17+
MAX_CONTENT(4),
18+
FIT_CONTENT(5),
19+
STRETCH(6);
20+
21+
public fun intValue(): Int = intValue
22+
23+
public companion object {
24+
@JvmStatic
25+
public fun fromInt(value: Int): YogaUnit =
26+
when (value) {
27+
0 -> UNDEFINED
28+
1 -> POINT
29+
2 -> PERCENT
30+
3 -> AUTO
31+
4 -> MAX_CONTENT
32+
5 -> FIT_CONTENT
33+
6 -> STRETCH
34+
else -> throw IllegalArgumentException("Unknown enum value: $value")
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)