Skip to content

Commit 7e4c994

Browse files
mateoguzmanameta-codesync[bot]
authored andcommitted
Generate Kotlin files with enums.py (#55631)
Summary: Pull Request resolved: #55631 This PR extends enums.py to also write Kotlin files. To introduce this in the least breaking manner, we can gradually do one by one and at the end clean up the Java script. Migrate YogaDirection to Kotlin. Changelog: [Internal] X-link: facebook/yoga#1845 Test Plan: RN ```sh yarn android yarn test-android ``` Yoga ```sh ./gradlew :yoga:assembleDebug ``` Reviewed By: cortinico Differential Revision: D93555645 Pulled By: NickGerleman fbshipit-source-id: cdddc9850f05cf0782cc4fdb782f22776ab12d31
1 parent 21ada9c commit 7e4c994

2 files changed

Lines changed: 29 additions & 35 deletions

File tree

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

Lines changed: 0 additions & 35 deletions
This file was deleted.
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 YogaDirection(public val intValue: Int) {
13+
INHERIT(0),
14+
LTR(1),
15+
RTL(2);
16+
17+
public fun intValue(): Int = intValue
18+
19+
public companion object {
20+
@JvmStatic
21+
public fun fromInt(value: Int): YogaDirection =
22+
when (value) {
23+
0 -> INHERIT
24+
1 -> LTR
25+
2 -> RTL
26+
else -> throw IllegalArgumentException("Unknown enum value: $value")
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)