mirror of
https://github.com/react/react-native.git
synced 2026-09-30 17:29:41 +08:00
Migrate YogaUnit enum to Kotlin (#56784)
Summary: X-link: https://github.com/facebook/yoga/pull/1944 Pull Request resolved: https://github.com/facebook/react-native/pull/56784 Migrate YogaUnit.java to YogaUnit.kt by adding Unit to KOTLIN_ENUM_NAMES in enums.py and regenerating. Reviewed By: fabriziocucci Differential Revision: D104666347 fbshipit-source-id: 99f58b2d1cbea1592a3f4d1aa2608d42ba17e095
This commit is contained in:
committed by
meta-codesync[bot]
parent
d181829b9c
commit
97cf21dd41
@@ -1,43 +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.
|
||||
*/
|
||||
|
||||
// @generated by enums.py
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
public enum YogaUnit {
|
||||
UNDEFINED(0),
|
||||
POINT(1),
|
||||
PERCENT(2),
|
||||
AUTO(3),
|
||||
MAX_CONTENT(4),
|
||||
FIT_CONTENT(5),
|
||||
STRETCH(6);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
YogaUnit(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static YogaUnit fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return UNDEFINED;
|
||||
case 1: return POINT;
|
||||
case 2: return PERCENT;
|
||||
case 3: return AUTO;
|
||||
case 4: return MAX_CONTENT;
|
||||
case 5: return FIT_CONTENT;
|
||||
case 6: return STRETCH;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// @generated by enums.py
|
||||
|
||||
package com.facebook.yoga
|
||||
|
||||
public enum class YogaUnit(public val intValue: Int) {
|
||||
UNDEFINED(0),
|
||||
POINT(1),
|
||||
PERCENT(2),
|
||||
AUTO(3),
|
||||
MAX_CONTENT(4),
|
||||
FIT_CONTENT(5),
|
||||
STRETCH(6);
|
||||
|
||||
public fun intValue(): Int = intValue
|
||||
|
||||
public companion object {
|
||||
@JvmStatic
|
||||
public fun fromInt(value: Int): YogaUnit =
|
||||
when (value) {
|
||||
0 -> UNDEFINED
|
||||
1 -> POINT
|
||||
2 -> PERCENT
|
||||
3 -> AUTO
|
||||
4 -> MAX_CONTENT
|
||||
5 -> FIT_CONTENT
|
||||
6 -> STRETCH
|
||||
else -> throw IllegalArgumentException("Unknown enum value: $value")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user