Skip to content

Commit 5dabf84

Browse files
committed
Migrate LayoutPassReason to Kotlin
1 parent 8bf7a34 commit 5dabf84

2 files changed

Lines changed: 34 additions & 43 deletions

File tree

java/com/facebook/yoga/LayoutPassReason.java

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
public fun fromInt(value: Int): LayoutPassReason =
22+
when (value) {
23+
0 -> INITIAL
24+
1 -> ABS_LAYOUT
25+
2 -> STRETCH
26+
3 -> MULTILINE_STRETCH
27+
4 -> FLEX_LAYOUT
28+
5 -> MEASURE
29+
6 -> ABS_MEASURE
30+
7 -> FLEX_MEASURE
31+
else -> throw IllegalArgumentException("Unknown enum value: $value")
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)