@@ -62,6 +62,7 @@ @interface RCTAnimation : NSObject
62
62
@property (nonatomic , readonly ) CGFloat springDamping;
63
63
@property (nonatomic , readonly ) CGFloat initialVelocity;
64
64
@property (nonatomic , readonly ) RCTAnimationType animationType;
65
+ @property (nonatomic , readonly ) CGFloat param;
65
66
66
67
@end
67
68
@@ -140,6 +141,7 @@ - (instancetype)initWithDuration:(NSTimeInterval)duration dictionary:(NSDictiona
140
141
_springDamping = [RCTConvert CGFloat: config[@" springDamping" ]];
141
142
_initialVelocity = [RCTConvert CGFloat: config[@" initialVelocity" ]];
142
143
}
144
+ _param = [RCTConvert CGFloat: config[@" param" ]];
143
145
}
144
146
return self;
145
147
}
@@ -651,12 +653,17 @@ - (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView *
651
653
652
654
CATransform3D finalTransform = view.layer .transform ;
653
655
CGFloat finalOpacity = view.layer .opacity ;
656
+ CGPoint finalPos = view.layer .position ;
654
657
655
658
NSString *property = createAnimation.property ;
656
659
if ([property isEqualToString: @" scaleXY" ]) {
657
660
view.layer .transform = CATransform3DMakeScale (0 , 0 , 0 );
658
661
} else if ([property isEqualToString: @" opacity" ]) {
659
662
view.layer .opacity = 0.0 ;
663
+ } else if ([property isEqualToString: @" translateX" ]) {
664
+ CGPoint pos = view.layer .position ;
665
+ pos.x += createAnimation.param ;
666
+ view.layer .position = pos;
660
667
} else {
661
668
RCTLogError (@" Unsupported layout animation createConfig property %@ " ,
662
669
createAnimation.property );
@@ -667,6 +674,8 @@ - (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView *
667
674
view.layer .transform = finalTransform;
668
675
} else if ([property isEqualToString: @" opacity" ]) {
669
676
view.layer .opacity = finalOpacity;
677
+ } else if ([property isEqualToString: @" translateX" ]) {
678
+ view.layer .position = finalPos;
670
679
}
671
680
if (updateBlock) {
672
681
updateBlock (self, viewRegistry);
@@ -829,6 +838,10 @@ - (void)_removeChildren:(NSArray<UIView *> *)children
829
838
removedChild.layer .transform = CATransform3DMakeScale (0.001 , 0.001 , 0.001 );
830
839
} else if ([property isEqualToString: @" opacity" ]) {
831
840
removedChild.layer .opacity = 0.0 ;
841
+ } else if ([property isEqualToString: @" translateX" ]) {
842
+ CGPoint pos = removedChild.layer .position ;
843
+ pos.x += deleteAnimation.param ;
844
+ removedChild.layer .position = pos;
832
845
} else {
833
846
RCTLogError (@" Unsupported layout animation createConfig property %@ " ,
834
847
deleteAnimation.property );
@@ -987,12 +1000,9 @@ - (void)_manageChildren:(NSNumber *)containerTag
987
1000
// When performing a delete animation, views are not removed immediately
988
1001
// from their container so we need to offset the insertion index if a view
989
1002
// that will be removed appears earlier than the view we are inserting.
990
- if (isUIViewRegistry && _viewsToBeDeleted.count > 0 ) {
991
- for (NSInteger index = 0 ; index < insertAtIndex; index ++) {
992
- UIView *subview = ((UIView *)container).reactSubviews [index ];
993
- if ([_viewsToBeDeleted containsObject: subview]) {
994
- insertAtIndex++;
995
- }
1003
+ if (isUIViewRegistry && removeAtIndices.count > 0 ) {
1004
+ if ([removeAtIndices containsObject: reactIndex]) {
1005
+ insertAtIndex++;
996
1006
}
997
1007
}
998
1008
0 commit comments