Skip to content

Commit db2a9c0

Browse files
mateoguzmanafacebook-github-bot
authored andcommitted
Migrate LayoutPassReason to Kotlin
Summary: Migrate com.facebook.yoga.LayoutPassReason to Kotlin. X-link: react/yoga#1836 Reviewed By: rshest Differential Revision: D79897685 Pulled By: cortinico fbshipit-source-id: 87d2e4b95fbdbfe48d84019e9ffb50deb9286d8c
1 parent 40afa75 commit db2a9c0

2 files changed

Lines changed: 35 additions & 43 deletions

File tree

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

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
package com.facebook.yoga
9+
10+
public enum class LayoutPassReason(public val intValue: Int) {
11+
INITIAL(0),
12+
ABS_LAYOUT(1),
13+
STRETCH(2),
14+
MULTILINE_STRETCH(3),
15+
FLEX_LAYOUT(4),
16+
MEASURE(5),
17+
ABS_MEASURE(6),
18+
FLEX_MEASURE(7);
19+
20+
public companion object {
21+
@JvmStatic
22+
public fun fromInt(value: Int): LayoutPassReason =
23+
when (value) {
24+
0 -> INITIAL
25+
1 -> ABS_LAYOUT
26+
2 -> STRETCH
27+
3 -> MULTILINE_STRETCH
28+
4 -> FLEX_LAYOUT
29+
5 -> MEASURE
30+
6 -> ABS_MEASURE
31+
7 -> FLEX_MEASURE
32+
else -> throw IllegalArgumentException("Unknown enum value: $value")
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)