Migrate YogaLayoutType
to Kotlin (#1837)
Summary: Migrate com.facebook.yoga.YogaLayoutType to Kotlin. Pull Request resolved: https://github.com/facebook/yoga/pull/1837 Test Plan: RN ```sh yarn android yarn test-android ``` Yoga ```sh ./gradlew :yoga:assembleDebug ``` Reviewed By: rshest Differential Revision: D79897708 Pulled By: cortinico fbshipit-source-id: e3c8a3cc60f806d151d2be956b26dd98963254a6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c90aecbdfe
commit
8087edaafe
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.yoga;
|
|
||||||
|
|
||||||
public enum YogaLayoutType {
|
|
||||||
LAYOUT(0),
|
|
||||||
MEASURE(1),
|
|
||||||
CACHED_LAYOUT(2),
|
|
||||||
CACHED_MEASURE(3);
|
|
||||||
|
|
||||||
private final int mIntValue;
|
|
||||||
|
|
||||||
YogaLayoutType(int intValue) {
|
|
||||||
mIntValue = intValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int intValue() {
|
|
||||||
return mIntValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static YogaLayoutType fromInt(int value) {
|
|
||||||
switch (value) {
|
|
||||||
case 0: return LAYOUT;
|
|
||||||
case 1: return MEASURE;
|
|
||||||
case 2: return CACHED_LAYOUT;
|
|
||||||
case 3: return CACHED_MEASURE;
|
|
||||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
27
java/com/facebook/yoga/YogaLayoutType.kt
Normal file
27
java/com/facebook/yoga/YogaLayoutType.kt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.yoga
|
||||||
|
|
||||||
|
public enum class YogaLayoutType(public val intValue: Int) {
|
||||||
|
LAYOUT(0),
|
||||||
|
MEASURE(1),
|
||||||
|
CACHED_LAYOUT(2),
|
||||||
|
CACHED_MEASURE(3);
|
||||||
|
|
||||||
|
public companion object {
|
||||||
|
@JvmStatic
|
||||||
|
public fun fromInt(value: Int): YogaLayoutType =
|
||||||
|
when (value) {
|
||||||
|
0 -> LAYOUT
|
||||||
|
1 -> MEASURE
|
||||||
|
2 -> CACHED_LAYOUT
|
||||||
|
3 -> CACHED_MEASURE
|
||||||
|
else -> throw IllegalArgumentException("Unknown enum value: $value")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user