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 <ListView> - 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 <ListView> - 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
This commit is contained in:
Janic Duplessis 2017-02-02 04:24:59 -08:00 committed by Facebook Github Bot
parent 12c4868628
commit ee737e7d1c
1 changed files with 2 additions and 2 deletions

View File

@ -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();