Skip to content

Commit

Permalink
Fix layout animations for views with a transform
Browse files Browse the repository at this point in the history
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 #12140

Differential Revision: D4494389

Pulled By: mkonicek

fbshipit-source-id: dd49cb2db9dd4950e293596fbc773f7d79e8b10a
  • Loading branch information
janicduplessis authored and facebook-github-bot committed Feb 2, 2017
1 parent 12c4868 commit ee737e7
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -21,8 +21,8 @@
public PositionAndSizeAnimation(View view, int x, int y, int width, int height) { public PositionAndSizeAnimation(View view, int x, int y, int width, int height) {
mView = view; mView = view;


mStartX = view.getX(); mStartX = view.getX() - view.getTranslationX();
mStartY = view.getY(); mStartY = view.getY() - view.getTranslationY();
mStartWidth = view.getWidth(); mStartWidth = view.getWidth();
mStartHeight = view.getHeight(); mStartHeight = view.getHeight();


Expand Down

0 comments on commit ee737e7

Please sign in to comment.