Skip to content

Commit 70a7106

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Migrate YogaWrap enum to Kotlin (facebook#1949)
Summary: Pull Request resolved: facebook#1949 X-link: facebook/react-native#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
1 parent ae0ed5a commit 70a7106

3 files changed

Lines changed: 30 additions & 35 deletions

File tree

enums.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
"Overflow",
115115
"PositionType",
116116
"Unit",
117+
"Wrap",
117118
}
118119

119120
ENUMS_KOTLIN = {name: ENUMS[name] for name in KOTLIN_ENUM_NAMES}

java/com/facebook/yoga/YogaWrap.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

java/com/facebook/yoga/YogaWrap.kt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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 YogaWrap(public val intValue: Int) {
13+
NO_WRAP(0),
14+
WRAP(1),
15+
WRAP_REVERSE(2);
16+
17+
public fun intValue(): Int = intValue
18+
19+
public companion object {
20+
@JvmStatic
21+
public fun fromInt(value: Int): YogaWrap =
22+
when (value) {
23+
0 -> NO_WRAP
24+
1 -> WRAP
25+
2 -> WRAP_REVERSE
26+
else -> throw IllegalArgumentException("Unknown enum value: $value")
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)