LayoutAnimation types to Kotlin (#43728)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43728

# Changelog:
[Internal] -

As in the title, converts corresponding type declarations in `react/uimanager/layoutanimation/*Type.kt` to Kotlin.

Differential Revision: D55574530

fbshipit-source-id: 8527b5c9b491435c60ed9c05092ffeccd7552f9c
This commit is contained in:
Ruslan Shestopalyuk
2024-04-01 12:37:48 -07:00
committed by Facebook GitHub Bot
parent 1e44cbe9f4
commit 287b5d697f
7 changed files with 109 additions and 110 deletions
@@ -5622,6 +5622,22 @@ public class com/facebook/react/uimanager/events/TouchesHelper {
public fun <init> ()V
}
public final class com/facebook/react/uimanager/layoutanimation/InterpolatorType : java/lang/Enum {
public static final field Companion Lcom/facebook/react/uimanager/layoutanimation/InterpolatorType$Companion;
public static final field EASE_IN Lcom/facebook/react/uimanager/layoutanimation/InterpolatorType;
public static final field EASE_IN_EASE_OUT Lcom/facebook/react/uimanager/layoutanimation/InterpolatorType;
public static final field EASE_OUT Lcom/facebook/react/uimanager/layoutanimation/InterpolatorType;
public static final field LINEAR Lcom/facebook/react/uimanager/layoutanimation/InterpolatorType;
public static final field SPRING Lcom/facebook/react/uimanager/layoutanimation/InterpolatorType;
public static final fun fromString (Ljava/lang/String;)Lcom/facebook/react/uimanager/layoutanimation/InterpolatorType;
public static fun valueOf (Ljava/lang/String;)Lcom/facebook/react/uimanager/layoutanimation/InterpolatorType;
public static fun values ()[Lcom/facebook/react/uimanager/layoutanimation/InterpolatorType;
}
public final class com/facebook/react/uimanager/layoutanimation/InterpolatorType$Companion {
public final fun fromString (Ljava/lang/String;)Lcom/facebook/react/uimanager/layoutanimation/InterpolatorType;
}
public class com/facebook/react/uimanager/layoutanimation/LayoutAnimationController {
public fun <init> ()V
public fun applyLayoutUpdate (Landroid/view/View;IIII)V
@@ -1,37 +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.react.uimanager.layoutanimation;
import com.facebook.infer.annotation.Nullsafe;
/**
* Enum representing the different view properties that can be used when animating layout for view
* creation.
*/
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
enum AnimatedPropertyType {
OPACITY,
SCALE_X,
SCALE_Y,
SCALE_XY;
public static AnimatedPropertyType fromString(String name) {
switch (name) {
case "opacity":
return OPACITY;
case "scaleX":
return SCALE_X;
case "scaleY":
return SCALE_Y;
case "scaleXY":
return SCALE_XY;
default:
throw new IllegalArgumentException("Unsupported animated property: " + name);
}
}
}
@@ -0,0 +1,32 @@
/*
* 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.react.uimanager.layoutanimation
/**
* Enum representing the different view properties that can be used when animating layout for view
* creation.
*/
internal enum class AnimatedPropertyType {
OPACITY,
SCALE_X,
SCALE_Y,
SCALE_XY;
companion object {
@JvmStatic
public fun fromString(name: String): AnimatedPropertyType {
return when (name) {
"opacity" -> OPACITY
"scaleX" -> SCALE_X
"scaleY" -> SCALE_Y
"scaleXY" -> SCALE_XY
else -> throw IllegalArgumentException("Unsupported animated property: $name")
}
}
}
}
@@ -1,40 +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.react.uimanager.layoutanimation;
import com.facebook.infer.annotation.Nullsafe;
import java.util.Locale;
/**
* Enum representing the different interpolators that can be used in layout animation configuration.
*/
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
enum InterpolatorType {
LINEAR,
EASE_IN,
EASE_OUT,
EASE_IN_EASE_OUT,
SPRING;
public static InterpolatorType fromString(String name) {
switch (name.toLowerCase(Locale.US)) {
case "linear":
return LINEAR;
case "easein":
return EASE_IN;
case "easeout":
return EASE_OUT;
case "easeineaseout":
return EASE_IN_EASE_OUT;
case "spring":
return SPRING;
default:
throw new IllegalArgumentException("Unsupported interpolation type : " + name);
}
}
}
@@ -0,0 +1,33 @@
/*
* 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.react.uimanager.layoutanimation
/**
* Enum representing the different interpolators that can be used in layout animation configuration.
*/
public enum class InterpolatorType {
LINEAR,
EASE_IN,
EASE_OUT,
EASE_IN_EASE_OUT,
SPRING;
public companion object {
@JvmStatic
public fun fromString(name: String): InterpolatorType {
return when (name.lowercase()) {
"linear" -> LINEAR
"easein" -> EASE_IN
"easeout" -> EASE_OUT
"easeineaseout" -> EASE_IN_EASE_OUT
"spring" -> SPRING
else -> throw IllegalArgumentException("Unsupported interpolation type : $name")
}
}
}
}
@@ -1,33 +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.react.uimanager.layoutanimation;
import com.facebook.infer.annotation.Nullsafe;
/**
* Enum representing the different animation type that can be specified in layout animation config.
*/
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
enum LayoutAnimationType {
CREATE,
UPDATE,
DELETE;
public static String toString(LayoutAnimationType type) {
switch (type) {
case CREATE:
return "create";
case UPDATE:
return "update";
case DELETE:
return "delete";
default:
throw new IllegalArgumentException("Unsupported LayoutAnimationType: " + type);
}
}
}
@@ -0,0 +1,28 @@
/*
* 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.react.uimanager.layoutanimation
/**
* Enum representing the different animation type that can be specified in layout animation config.
*/
internal enum class LayoutAnimationType {
CREATE,
UPDATE,
DELETE;
companion object {
@JvmStatic
fun toString(type: LayoutAnimationType): String {
return when (type) {
CREATE -> "create"
UPDATE -> "update"
DELETE -> "delete"
}
}
}
}