Add support for delete animation in LayoutAnimation on iOS

Summary:This adds support for delete view animations in LayoutAnimation for iOS. It supports the same properties as the create animation (alpha, scale).

This allows making simple animations when removing a view which is normally hard to do in React since we need to not remove the view node immediately.

**Test plan**
Tested add/removing views in the UIExample explorer with and without setting a LayoutAnimation. Also tested that the completion callback still works properly. Tested that user interation during the animation is properly disabled.

![layout-anim2](https://cloud.githubusercontent.com/assets/2677334/14595471/86fb1654-050d-11e6-8b38-fe45cc2dcd71.gif)

I also plan to work on improving the doc for LayoutAnimation as well as making this PR for android too.
Closes https://github.com/facebook/react-native/pull/6779

Differential Revision: D3215525

Pulled By: sahrens

fb-gh-sync-id: 526120acd371c8d1af433e8f199cfed336183775
fbshipit-source-id: 526120acd371c8d1af433e8f199cfed336183775
This commit is contained in:
Janic Duplessis
2016-04-25 00:08:42 -07:00
committed by Facebook Github Bot 7
parent 23918692ac
commit baa3668160
5 changed files with 252 additions and 35 deletions

View File

@@ -86,6 +86,10 @@ function create(duration: number, type, creationProp): Config {
update: {
type,
},
delete: {
type,
property: creationProp,
},
};
}
@@ -106,6 +110,10 @@ var Presets = {
type: Types.spring,
springDamping: 0.4,
},
delete: {
type: Types.linear,
property: Properties.opacity,
},
},
};