Skip to content

Commit bca7c5a

Browse files
tomekzawfacebook-github-bot
authored andcommitted
Restore the possibility to extend LayoutAnimationController (#51479)
Summary: In #50734, `LayoutAnimationController` was migrated to Kotlin and all of its methods are now marked as final. However, this class is used and extended by `react-native-reanimated` in order to provide Layout Animations for Android on the Old Architecture. With all its methods being marked as final, the builds are failing. This PR restores the possibility to extend `LayoutAnimationController`. ## Changelog: [ANDROID] [FIXED] - Restored the possibility to extend `LayoutAnimationController` Pull Request resolved: #51479 Test Plan: I've checked that this PR fixes build errors caused by `LayoutAnimationController` in react-native-reanimated. Reviewed By: cipolleschi, mdvacca Differential Revision: D75079557 Pulled By: cortinico fbshipit-source-id: beeb700cbad87362dda4b60941124562c4753815
1 parent 580de87 commit bca7c5a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5062,13 +5062,13 @@ public final class com/facebook/react/uimanager/events/TouchEventType$Companion
50625062
public final fun getJSEventName (Lcom/facebook/react/uimanager/events/TouchEventType;)Ljava/lang/String;
50635063
}
50645064

5065-
public final class com/facebook/react/uimanager/layoutanimation/LayoutAnimationController {
5065+
public class com/facebook/react/uimanager/layoutanimation/LayoutAnimationController {
50665066
public fun <init> ()V
5067-
public final fun applyLayoutUpdate (Landroid/view/View;IIII)V
5068-
public final fun deleteView (Landroid/view/View;Lcom/facebook/react/uimanager/layoutanimation/LayoutAnimationListener;)V
5067+
public fun applyLayoutUpdate (Landroid/view/View;IIII)V
5068+
public fun deleteView (Landroid/view/View;Lcom/facebook/react/uimanager/layoutanimation/LayoutAnimationListener;)V
50695069
public final fun initializeFromConfig (Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Callback;)V
5070-
public final fun reset ()V
5071-
public final fun shouldAnimateLayout (Landroid/view/View;)Z
5070+
public fun reset ()V
5071+
public fun shouldAnimateLayout (Landroid/view/View;)Z
50725072
}
50735073

50745074
public abstract interface class com/facebook/react/uimanager/layoutanimation/LayoutAnimationListener {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import javax.annotation.concurrent.NotThreadSafe
2929
*/
3030
@NotThreadSafe
3131
@LegacyArchitecture
32-
public class LayoutAnimationController {
32+
public open class LayoutAnimationController {
3333
private val layoutCreateAnimation: AbstractLayoutAnimation = LayoutCreateAnimation()
3434
private val layoutUpdateAnimation: AbstractLayoutAnimation = LayoutUpdateAnimation()
3535
private val layoutDeleteAnimation: AbstractLayoutAnimation = LayoutDeleteAnimation()
@@ -68,7 +68,7 @@ public class LayoutAnimationController {
6868
}
6969
}
7070

71-
public fun reset() {
71+
public open fun reset() {
7272
layoutCreateAnimation.reset()
7373
layoutUpdateAnimation.reset()
7474
layoutDeleteAnimation.reset()
@@ -83,7 +83,7 @@ public class LayoutAnimationController {
8383
}
8484
}
8585

86-
public fun shouldAnimateLayout(viewToAnimate: View?): Boolean {
86+
public open fun shouldAnimateLayout(viewToAnimate: View?): Boolean {
8787
// if view parent is null, skip animation: view have been clipped, we don't want animation to
8888
// resume when view is re-attached to parent, which is the standard android animation behavior.
8989
// If there's a layout handling animation going on, it should be animated nonetheless since the
@@ -106,7 +106,7 @@ public class LayoutAnimationController {
106106
* @param width the new width value for the view
107107
* @param height the new height value for the view
108108
*/
109-
public fun applyLayoutUpdate(view: View, x: Int, y: Int, width: Int, height: Int) {
109+
public open fun applyLayoutUpdate(view: View, x: Int, y: Int, width: Int, height: Int) {
110110
assertOnUiThread()
111111

112112
val reactTag = view.id
@@ -167,7 +167,7 @@ public class LayoutAnimationController {
167167
* @param listener Called once the animation is finished, should be used to completely remove the
168168
* view.
169169
*/
170-
public fun deleteView(view: View, listener: LayoutAnimationListener) {
170+
public open fun deleteView(view: View, listener: LayoutAnimationListener) {
171171
assertOnUiThread()
172172

173173
val animation =

0 commit comments

Comments
 (0)