From ee737e7d1c2b60d2226bc9fcab372ce98b5976f1 Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Thu, 2 Feb 2017 04:24:59 -0800 Subject: [PATCH] Fix layout animations for views with a transform Summary: Fixes LayoutAnimation when animating the position of a view that has a transform, the animation would start at the wrong position, offset by the transform translation value. I noticed this bug while working on sticky headers using animated in the UIExplorer - Paging example. **Test plan** Made a simple repro for the bug https://gist.github.com/janicduplessis/eb985dc3accfd5982c77761be692e395 and tested that it fixed it. Also tested that the UIExplorer - Paging example with sticky headers worked properly with this fix. Closes https://github.com/facebook/react-native/pull/12140 Differential Revision: D4494389 Pulled By: mkonicek fbshipit-source-id: dd49cb2db9dd4950e293596fbc773f7d79e8b10a --- .../uimanager/layoutanimation/PositionAndSizeAnimation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/PositionAndSizeAnimation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/PositionAndSizeAnimation.java index 2adf81a6b..1cb3e83ac 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/PositionAndSizeAnimation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/PositionAndSizeAnimation.java @@ -21,8 +21,8 @@ import android.view.animation.Transformation; public PositionAndSizeAnimation(View view, int x, int y, int width, int height) { mView = view; - mStartX = view.getX(); - mStartY = view.getY(); + mStartX = view.getX() - view.getTranslationX(); + mStartY = view.getY() - view.getTranslationY(); mStartWidth = view.getWidth(); mStartHeight = view.getHeight();