Respect destination vaules in LayoutAnimation create

Reviewed By: nicklockwood

Differential Revision: D2544389

fb-gh-sync-id: 9e6abdbd1f500578369e5f2c3e34d7f5ef047f5e
This commit is contained in:
Ryan Olson 2015-10-16 08:37:27 -07:00 committed by facebook-github-bot-3
parent c0b5e6ed67
commit 1091ecd8e0
1 changed files with 4 additions and 2 deletions

View File

@ -526,6 +526,8 @@ extern NSString *RCTBridgeModuleNameForClass(Class cls);
// Animate view creation // Animate view creation
if (createAnimation) { if (createAnimation) {
CATransform3D finalTransform = view.layer.transform;
CGFloat finalOpacity = view.layer.opacity;
if ([createAnimation.property isEqualToString:@"scaleXY"]) { if ([createAnimation.property isEqualToString:@"scaleXY"]) {
view.layer.transform = CATransform3DMakeScale(0, 0, 0); view.layer.transform = CATransform3DMakeScale(0, 0, 0);
} else if ([createAnimation.property isEqualToString:@"opacity"]) { } else if ([createAnimation.property isEqualToString:@"opacity"]) {
@ -533,9 +535,9 @@ extern NSString *RCTBridgeModuleNameForClass(Class cls);
} }
[createAnimation performAnimations:^{ [createAnimation performAnimations:^{
if ([createAnimation.property isEqual:@"scaleXY"]) { if ([createAnimation.property isEqual:@"scaleXY"]) {
view.layer.transform = CATransform3DIdentity; view.layer.transform = finalTransform;
} else if ([createAnimation.property isEqual:@"opacity"]) { } else if ([createAnimation.property isEqual:@"opacity"]) {
view.layer.opacity = 1.0; view.layer.opacity = finalOpacity;
} else { } else {
RCTLogError(@"Unsupported layout animation createConfig property %@", RCTLogError(@"Unsupported layout animation createConfig property %@",
createAnimation.property); createAnimation.property);