Skip to content

Commit

Permalink
Mark all LayoutAnination classes as LegacyArchitecture
Browse files Browse the repository at this point in the history
Summary: LayoutAnination classes are not used on the new architecture, this diff marks the as LegacyArchitecture to drive its removal

Differential Revision: D70410096
  • Loading branch information
mdvacca committed Mar 2, 2025
1 parent 42a7c62 commit dddb72e
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
import com.facebook.react.uimanager.IllegalViewOperationException;
import java.util.Map;

/**
* Class responsible for parsing and converting layout animation data into native {@link Animation}
* in order to animate layout when a valid configuration has been supplied by the application.
*/
@LegacyArchitecture
/* package */ abstract class AbstractLayoutAnimation {

// Forces animation to be playing 10x slower, used for debug purposes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

package com.facebook.react.uimanager.layoutanimation

import com.facebook.react.common.annotations.internal.LegacyArchitecture

/**
* Enum representing the different view properties that can be used when animating layout for view
* creation.
*/
@LegacyArchitecture
internal enum class AnimatedPropertyType {
OPACITY,
SCALE_X,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
import com.facebook.react.uimanager.IllegalViewOperationException;

/** Class responsible for default layout animation, i.e animation of view creation and deletion. */
@LegacyArchitecture
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
abstract class BaseLayoutAnimation extends AbstractLayoutAnimation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

package com.facebook.react.uimanager.layoutanimation

import com.facebook.react.common.annotations.internal.LegacyArchitecture

/** Listener invoked when a layout animation has completed. */
@LegacyArchitecture
public fun interface LayoutAnimationListener {
public fun onAnimationEnd()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@

package com.facebook.react.uimanager.layoutanimation

import com.facebook.react.common.annotations.internal.LegacyArchitecture

/**
* Enum representing the different animation type that can be specified in layout animation config.
*/
@LegacyArchitecture
internal enum class LayoutAnimationType {
CREATE,
UPDATE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

package com.facebook.react.uimanager.layoutanimation

import com.facebook.react.common.annotations.internal.LegacyArchitecture

/**
* Class responsible for handling layout view creation animation, applied to view whenever a valid
* config was supplied for the layout animation of CREATE type.
*/
@LegacyArchitecture
internal class LayoutCreateAnimation : BaseLayoutAnimation() {

override fun isReverse(): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

package com.facebook.react.uimanager.layoutanimation

import com.facebook.react.common.annotations.internal.LegacyArchitecture

/**
* Class responsible for handling layout view deletion animation, applied to view whenever a valid
* config was supplied for the layout animation of DELETE type.
*/
@LegacyArchitecture
internal class LayoutDeleteAnimation : BaseLayoutAnimation() {

override fun isReverse(): Boolean = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

package com.facebook.react.uimanager.layoutanimation

import com.facebook.react.common.annotations.internal.LegacyArchitecture

/** Interface for an animation type that takes care of updating the view layout. */
@LegacyArchitecture
internal interface LayoutHandlingAnimation {
/**
* Notifies the animation of a layout update in case one occurs during the animation. This avoids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ package com.facebook.react.uimanager.layoutanimation
import android.view.View
import android.view.animation.Animation
import android.view.animation.TranslateAnimation
import com.facebook.react.common.annotations.internal.LegacyArchitecture

/**
* Class responsible for handling layout update animation, applied to view whenever a valid config
* was supplied for the layout animation of UPDATE type.
*/
@LegacyArchitecture
internal class LayoutUpdateAnimation : AbstractLayoutAnimation() {

internal override fun isValid(): Boolean = mDurationMs > 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
import android.view.animation.Animation;
import android.view.animation.Transformation;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;

/**
* Animation responsible for updating opacity of a view. It should ideally use hardware texture to
* optimize rendering performances.
*/
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
@LegacyArchitecture
class OpacityAnimation extends Animation {

static class OpacityAnimationListener implements Animation.AnimationListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
import android.view.animation.Animation;
import android.view.animation.Transformation;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.common.annotations.internal.LegacyArchitecture;

/**
* Animation responsible for updating size and position of a view. We can't use scaling as view
* content may not necessarily stretch. As a result, this approach is inefficient because of layout
* passes occurring on every frame. What we might want to try to do instead is use a combined
* ScaleAnimation and TranslateAnimation.
*/
@LegacyArchitecture
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
class PositionAndSizeAnimation extends Animation implements LayoutHandlingAnimation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import android.view.animation.Interpolator
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.bridge.ReadableType
import com.facebook.react.bridge.ReadableType.Number
import com.facebook.react.common.annotations.internal.LegacyArchitecture

/** Simple spring interpolator */
// TODO(7613736): Improve spring interpolator with friction and damping variable support
/* package */
@LegacyArchitecture
internal class SimpleSpringInterpolator : Interpolator {
private val _springDamping: Float

Expand Down

0 comments on commit dddb72e

Please sign in to comment.