Browse Source

refactored transition animations (#2604)

* refactored transition animations

* unit test fix
yogevbd 7 years ago
parent
commit
ae4f1caa0c
No account linked to committer's email address

+ 2
- 2
lib/ios/RNNAnimator.h View File

1
 #import <Foundation/Foundation.h>
1
 #import <Foundation/Foundation.h>
2
 #import <UIKit/UIKit.h>
2
 #import <UIKit/UIKit.h>
3
 #import "RNNElementView.h"
3
 #import "RNNElementView.h"
4
+#import "RNNTransitionOptions.h"
4
 
5
 
5
 @interface RNNAnimator : NSObject <UIViewControllerAnimatedTransitioning>
6
 @interface RNNAnimator : NSObject <UIViewControllerAnimatedTransitioning>
6
 
7
 
7
--(instancetype)initWithAnimationsDictionary:(NSDictionary *)animationsDic;
8
--(void)setupTransition:(NSDictionary*)data;
8
+-(instancetype)initWithTransitionOptions:(RNNTransitionOptions *)transitionOptions;
9
 
9
 
10
 @end
10
 @end

+ 16
- 39
lib/ios/RNNAnimator.m View File

9
 #import "RNNAnimatedView.h"
9
 #import "RNNAnimatedView.h"
10
 
10
 
11
 @interface  RNNAnimator()
11
 @interface  RNNAnimator()
12
-@property (nonatomic, strong)NSArray* animations;
13
-@property (nonatomic)double duration;
14
-@property (nonatomic)double springDamping;
15
-@property (nonatomic)double springVelocity;
12
+@property (nonatomic, strong) RNNTransitionOptions* transitionOptions;
16
 @property (nonatomic, strong) RNNInteractivePopAnimator* interactivePopAnimator;
13
 @property (nonatomic, strong) RNNInteractivePopAnimator* interactivePopAnimator;
17
 @property (nonatomic) BOOL backButton;
14
 @property (nonatomic) BOOL backButton;
18
 @property (nonatomic, strong) UIViewController* fromVC;
15
 @property (nonatomic, strong) UIViewController* fromVC;
21
 
18
 
22
 @implementation RNNAnimator
19
 @implementation RNNAnimator
23
 
20
 
24
-- (instancetype)initWithAnimationsDictionary:(NSDictionary *)animationsDic {
21
+-(instancetype)initWithTransitionOptions:(RNNTransitionOptions *)transitionOptions {
25
 	self = [super init];
22
 	self = [super init];
26
-	if (animationsDic) {
27
-		[self setupTransition:animationsDic];
23
+	if (transitionOptions) {
24
+		[self setupTransition:transitionOptions];
28
 	} else {
25
 	} else {
29
 		return nil;
26
 		return nil;
30
 	}
27
 	}
32
 	return self;
29
 	return self;
33
 }
30
 }
34
 
31
 
35
--(void)setupTransition:(NSDictionary*)data{
36
-	if ([data objectForKey:@"animations"]) {
37
-		self.animations= [data objectForKey:@"animations"];
38
-	} else {
32
+-(void)setupTransition:(RNNTransitionOptions *)transitionOptions {
33
+	self.transitionOptions = transitionOptions;
34
+	if (!transitionOptions.animations) {
39
 		[[NSException exceptionWithName:NSInvalidArgumentException reason:@"No animations" userInfo:nil] raise];
35
 		[[NSException exceptionWithName:NSInvalidArgumentException reason:@"No animations" userInfo:nil] raise];
40
 	}
36
 	}
41
-	if ([data objectForKey:@"duration"]) {
42
-		self.duration = [[data objectForKey:@"duration"] doubleValue];
43
-	} else {
44
-		self.duration = 0.7;
45
-	}
46
-	if ([data objectForKey:@"springDamping"]) {
47
-		self.springDamping = [[data objectForKey:@"springDamping"] doubleValue];
48
-	} else {
49
-		self.springDamping = 0.85;
50
-	}
51
-	if ([data objectForKey:@"springVelocity"]) {
52
-		self.springVelocity= [[data objectForKey:@"springVelocity"] doubleValue];
53
-	} else {
54
-		self.springVelocity = 0.8;
55
-	}
56
 	
37
 	
57
 	self.backButton = false;
38
 	self.backButton = false;
58
 }
39
 }
59
 
40
 
60
 -(NSArray*)prepareSharedElementTransition:(NSArray*)RNNSharedElementsToVC
41
 -(NSArray*)prepareSharedElementTransition:(NSArray*)RNNSharedElementsToVC
61
 						andfromVCElements:(NSArray*)RNNSharedElementsFromVC
42
 						andfromVCElements:(NSArray*)RNNSharedElementsFromVC
62
-						withComponentView:(UIView*)componentView
63
-{
43
+						withComponentView:(UIView*)componentView {
64
 	NSMutableArray* transitions = [NSMutableArray new];
44
 	NSMutableArray* transitions = [NSMutableArray new];
65
-	for (NSDictionary* transition in self.animations) {
45
+	for (NSDictionary* transition in self.transitionOptions.animations) {
66
 		RNNTransitionStateHolder* transitionStateHolder = [[RNNTransitionStateHolder alloc] initWithTransition:transition];
46
 		RNNTransitionStateHolder* transitionStateHolder = [[RNNTransitionStateHolder alloc] initWithTransition:transition];
67
 		RNNElementFinder* elementFinder = [[RNNElementFinder alloc] initWithToVC:self.toVC andfromVC:self.fromVC];
47
 		RNNElementFinder* elementFinder = [[RNNElementFinder alloc] initWithToVC:self.toVC andfromVC:self.fromVC];
68
 		[elementFinder findElementsInTransition:transitionStateHolder];
48
 		[elementFinder findElementsInTransition:transitionStateHolder];
73
 		[componentView bringSubviewToFront:animatedView];
53
 		[componentView bringSubviewToFront:animatedView];
74
 		transitionStateHolder.animatedView = animatedView;
54
 		transitionStateHolder.animatedView = animatedView;
75
 		[transitions addObject:transitionStateHolder];
55
 		[transitions addObject:transitionStateHolder];
76
-		if (transitionStateHolder.isSharedElementTransition){
56
+		if (transitionStateHolder.isSharedElementTransition) {
77
 			[transitionStateHolder.toElement setHidden: YES];
57
 			[transitionStateHolder.toElement setHidden: YES];
78
 		}
58
 		}
79
 		[transitionStateHolder.fromElement setHidden:YES];
59
 		[transitionStateHolder.fromElement setHidden:YES];
112
 
92
 
113
 
93
 
114
 -(void)animateComplition:(NSArray*)transitions fromVCSnapshot:(UIView*)fromSnapshot andTransitioningContext:(id<UIViewControllerContextTransitioning>)transitionContext {
94
 -(void)animateComplition:(NSArray*)transitions fromVCSnapshot:(UIView*)fromSnapshot andTransitioningContext:(id<UIViewControllerContextTransitioning>)transitionContext {
115
-	[UIView animateWithDuration:[self transitionDuration:transitionContext ] delay:0 usingSpringWithDamping:self.springDamping initialSpringVelocity:self.springVelocity options:UIViewAnimationOptionCurveEaseOut  animations:^{
95
+	[UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0 usingSpringWithDamping:[self.transitionOptions.springDamping doubleValue] initialSpringVelocity:[self.transitionOptions.springVelocity doubleValue] options:UIViewAnimationOptionCurveEaseOut  animations:^{
116
 				self.toVC.view.alpha = 1;
96
 				self.toVC.view.alpha = 1;
117
 			} completion:^(BOOL finished) {
97
 			} completion:^(BOOL finished) {
118
 				for (RNNTransitionStateHolder* transition in transitions ) {
98
 				for (RNNTransitionStateHolder* transition in transitions ) {
139
 			}];
119
 			}];
140
 }
120
 }
141
 
121
 
142
-- (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext
143
-{
144
-	return self.duration;
122
+- (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext {
123
+	return [self.transitionOptions.duration doubleValue];
145
 }
124
 }
146
-- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
147
-{
125
+
126
+- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
148
 	UIViewController* toVC   = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
127
 	UIViewController* toVC   = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
149
 	UIViewController* fromVC  = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
128
 	UIViewController* fromVC  = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
150
 	UIView* componentView = [transitionContext containerView];
129
 	UIView* componentView = [transitionContext containerView];
162
 	[self animateComplition:transitions fromVCSnapshot:fromSnapshot andTransitioningContext:transitionContext];
141
 	[self animateComplition:transitions fromVCSnapshot:fromSnapshot andTransitioningContext:transitionContext];
163
 	[self animateTransitions:transitions];
142
 	[self animateTransitions:transitions];
164
 }
143
 }
165
-@end
166
-
167
-
168
 
144
 
145
+@end

+ 7
- 4
lib/ios/RNNCommandsHandler.m View File

77
 		[_controllerFactory.eventEmitter sendNavigationEvent:[RNNNavigationEvent create:kPop fromComponent:nil toComponent:componentId]];
77
 		[_controllerFactory.eventEmitter sendNavigationEvent:[RNNNavigationEvent create:kPop fromComponent:nil toComponent:componentId]];
78
 		completion();
78
 		completion();
79
 	}];
79
 	}];
80
+	
80
 	NSDictionary* animationData = options[@"customTransition"];
81
 	NSDictionary* animationData = options[@"customTransition"];
81
-	if (animationData){
82
-		if ([animationData objectForKey:@"animations"]) {
83
-			[_navigationStackManager pop:componentId withAnimationData:animationData];
82
+	RNNTransitionOptions* transitionOptions = [[RNNTransitionOptions alloc] initWithDict:animationData];
83
+	
84
+	if (transitionOptions){
85
+		if (transitionOptions.animations) {
86
+			[_navigationStackManager pop:componentId withTransitionOptions:transitionOptions];
84
 		} else {
87
 		} else {
85
 			[[NSException exceptionWithName:NSInvalidArgumentException reason:@"unsupported transitionAnimation" userInfo:nil] raise];
88
 			[[NSException exceptionWithName:NSInvalidArgumentException reason:@"unsupported transitionAnimation" userInfo:nil] raise];
86
 		}
89
 		}
87
 	} else {
90
 	} else {
88
-		[_navigationStackManager pop:componentId withAnimationData:nil];
91
+		[_navigationStackManager pop:componentId withTransitionOptions:nil];
89
 	}
92
 	}
90
 	[CATransaction commit];
93
 	[CATransaction commit];
91
 }
94
 }

+ 1
- 3
lib/ios/RNNControllerFactory.m View File

85
 
85
 
86
 - (UIViewController<RNNRootViewProtocol> *)createComponent:(RNNLayoutNode*)node {
86
 - (UIViewController<RNNRootViewProtocol> *)createComponent:(RNNLayoutNode*)node {
87
 	NSString* name = node.data[@"name"];
87
 	NSString* name = node.data[@"name"];
88
-	NSDictionary* customTransition = node.data[@"customTransition"];
89
-	RNNAnimator* animator = [[RNNAnimator alloc] initWithAnimationsDictionary:customTransition];
90
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];
88
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];
91
 	options.defaultOptions = _defaultOptions;
89
 	options.defaultOptions = _defaultOptions;
92
 	NSString* componentId = node.nodeId;
90
 	NSString* componentId = node.nodeId;
93
-	RNNRootViewController* component = [[RNNRootViewController alloc] initWithName:name withOptions:options withComponentId:componentId rootViewCreator:_creator eventEmitter:_eventEmitter animator:animator];
91
+	RNNRootViewController* component = [[RNNRootViewController alloc] initWithName:name withOptions:options withComponentId:componentId rootViewCreator:_creator eventEmitter:_eventEmitter];
94
 	CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
92
 	CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
95
 	[_bridge.uiManager setAvailableSize:availableSize forRootView:component.view];
93
 	[_bridge.uiManager setAvailableSize:availableSize forRootView:component.view];
96
 	
94
 	

+ 2
- 1
lib/ios/RNNNavigationOptions.h View File

6
 #import "RNNTopTabOptions.h"
6
 #import "RNNTopTabOptions.h"
7
 #import "RNNTopTabsOptions.h"
7
 #import "RNNTopTabsOptions.h"
8
 #import "RNNOverlayOptions.h"
8
 #import "RNNOverlayOptions.h"
9
+#import "RNNTransitionOptions.h"
9
 
10
 
10
 extern const NSInteger BLUR_STATUS_TAG;
11
 extern const NSInteger BLUR_STATUS_TAG;
11
 extern const NSInteger BLUR_TOPBAR_TAG;
12
 extern const NSInteger BLUR_TOPBAR_TAG;
20
 @property (nonatomic, strong) RNNTopTabOptions* topTab;
21
 @property (nonatomic, strong) RNNTopTabOptions* topTab;
21
 @property (nonatomic, strong) RNNSideMenuOptions* sideMenu;
22
 @property (nonatomic, strong) RNNSideMenuOptions* sideMenu;
22
 @property (nonatomic, strong) RNNOverlayOptions* overlay;
23
 @property (nonatomic, strong) RNNOverlayOptions* overlay;
24
+@property (nonatomic, strong) RNNTransitionOptions* customTransition;
23
 
25
 
24
 @property (nonatomic, strong) RNNNavigationOptions* defaultOptions;
26
 @property (nonatomic, strong) RNNNavigationOptions* defaultOptions;
25
 
27
 
35
 @property (nonatomic, strong) UIImage* backgroundImage;
37
 @property (nonatomic, strong) UIImage* backgroundImage;
36
 @property (nonatomic, strong) UIImage* rootBackgroundImage;
38
 @property (nonatomic, strong) UIImage* rootBackgroundImage;
37
 
39
 
38
-
39
 - (UIInterfaceOrientationMask)supportedOrientations;
40
 - (UIInterfaceOrientationMask)supportedOrientations;
40
 
41
 
41
 
42
 

+ 1
- 0
lib/ios/RNNNavigationOptions.m View File

32
 	self.bottomTab = [[RNNBottomTabOptions alloc] initWithDict:[options objectForKey:@"bottomTab"]];
32
 	self.bottomTab = [[RNNBottomTabOptions alloc] initWithDict:[options objectForKey:@"bottomTab"]];
33
 	self.overlay = [[RNNOverlayOptions alloc] initWithDict:[options objectForKey:@"overlay"]];
33
 	self.overlay = [[RNNOverlayOptions alloc] initWithDict:[options objectForKey:@"overlay"]];
34
 	self.animated = [options objectForKey:@"animated"];
34
 	self.animated = [options objectForKey:@"animated"];
35
+	self.customTransition = [[RNNTransitionOptions alloc] initWithDict:[options objectForKey:@"customTransition"]];
35
 	
36
 	
36
 	return self;
37
 	return self;
37
 }
38
 }

+ 1
- 1
lib/ios/RNNNavigationStackManager.h View File

11
 
11
 
12
 
12
 
13
 -(void)push:(UIViewController<RNNRootViewProtocol>*)newTop onTop:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion;
13
 -(void)push:(UIViewController<RNNRootViewProtocol>*)newTop onTop:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion;
14
--(void)pop:(NSString*)componentId withAnimationData:(NSDictionary*)animationData;
14
+-(void)pop:(NSString*)componentId withTransitionOptions:(RNNTransitionOptions*)transitionOptions;
15
 -(void)popTo:(NSString*)componentId;
15
 -(void)popTo:(NSString*)componentId;
16
 -(void)popToRoot:(NSString*)componentId;
16
 -(void)popToRoot:(NSString*)componentId;
17
 
17
 

+ 3
- 3
lib/ios/RNNNavigationStackManager.m View File

60
 	self.fromVC = nil;
60
 	self.fromVC = nil;
61
 }
61
 }
62
 
62
 
63
--(void)pop:(NSString *)componentId withAnimationData:(NSDictionary *)animationData {
63
+-(void)pop:(NSString *)componentId withTransitionOptions:(RNNTransitionOptions *)transitionOptions {
64
 	UIViewController<RNNRootViewProtocol>* vc = (UIViewController<RNNRootViewProtocol>*)[_store findComponentForId:componentId];
64
 	UIViewController<RNNRootViewProtocol>* vc = (UIViewController<RNNRootViewProtocol>*)[_store findComponentForId:componentId];
65
 	UINavigationController* nvc = [vc navigationController];
65
 	UINavigationController* nvc = [vc navigationController];
66
 	if ([nvc topViewController] == vc) {
66
 	if ([nvc topViewController] == vc) {
67
-		if (animationData) {
67
+		if (transitionOptions) {
68
 			RNNRootViewController* RNNVC = (RNNRootViewController*)vc;
68
 			RNNRootViewController* RNNVC = (RNNRootViewController*)vc;
69
 			nvc.delegate = RNNVC;
69
 			nvc.delegate = RNNVC;
70
-			[RNNVC.animator setupTransition:animationData];
70
+			RNNVC.animator = [[RNNAnimator alloc] initWithTransitionOptions:transitionOptions];
71
 			[nvc popViewControllerAnimated:vc.isAnimated];
71
 			[nvc popViewControllerAnimated:vc.isAnimated];
72
 		} else {
72
 		} else {
73
 			nvc.delegate = nil;
73
 			nvc.delegate = nil;

+ 2
- 3
lib/ios/RNNRootViewController.h View File

12
 @interface RNNRootViewController : UIViewController	<RNNRootViewProtocol>
12
 @interface RNNRootViewController : UIViewController	<RNNRootViewProtocol>
13
 
13
 
14
 @property (nonatomic, strong) RNNNavigationOptions* options;
14
 @property (nonatomic, strong) RNNNavigationOptions* options;
15
-@property (nonatomic, strong) RNNAnimator* animator;
16
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
15
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
17
 @property (nonatomic, strong) NSString* componentId;
16
 @property (nonatomic, strong) NSString* componentId;
18
 @property (nonatomic, strong) RNNTopTabsViewController* topTabsViewController;
17
 @property (nonatomic, strong) RNNTopTabsViewController* topTabsViewController;
18
+@property (nonatomic, strong) RNNAnimator* animator;
19
 
19
 
20
 -(instancetype)initWithName:(NSString*)name
20
 -(instancetype)initWithName:(NSString*)name
21
 				withOptions:(RNNNavigationOptions*)options
21
 				withOptions:(RNNNavigationOptions*)options
22
 			withComponentId:(NSString*)componentId
22
 			withComponentId:(NSString*)componentId
23
 			rootViewCreator:(id<RNNRootViewCreator>)creator
23
 			rootViewCreator:(id<RNNRootViewCreator>)creator
24
-			   eventEmitter:(RNNEventEmitter*)eventEmitter
25
-		   animator:(RNNAnimator*)animator;
24
+			   eventEmitter:(RNNEventEmitter*)eventEmitter;
26
 
25
 
27
 
26
 
28
 -(void)applyTabBarItem;
27
 -(void)applyTabBarItem;

+ 3
- 4
lib/ios/RNNRootViewController.m View File

15
 				withOptions:(RNNNavigationOptions*)options
15
 				withOptions:(RNNNavigationOptions*)options
16
 			withComponentId:(NSString*)componentId
16
 			withComponentId:(NSString*)componentId
17
 			rootViewCreator:(id<RNNRootViewCreator>)creator
17
 			rootViewCreator:(id<RNNRootViewCreator>)creator
18
-			   eventEmitter:(RNNEventEmitter*)eventEmitter
19
-				   animator:(RNNAnimator *)animator {
18
+			   eventEmitter:(RNNEventEmitter*)eventEmitter {
20
 	self = [super init];
19
 	self = [super init];
21
 	self.componentId = componentId;
20
 	self.componentId = componentId;
22
 	self.componentName = name;
21
 	self.componentName = name;
23
 	self.options = options;
22
 	self.options = options;
24
 	self.eventEmitter = eventEmitter;
23
 	self.eventEmitter = eventEmitter;
25
-	self.animator = animator;
24
+	self.animator = [[RNNAnimator alloc] initWithTransitionOptions:self.options.customTransition];
26
 	self.view = [creator createRootView:self.componentName rootViewId:self.componentId];
25
 	self.view = [creator createRootView:self.componentName rootViewId:self.componentId];
27
 	
26
 	
28
 	[[NSNotificationCenter defaultCenter] addObserver:self
27
 	[[NSNotificationCenter defaultCenter] addObserver:self
67
 }
66
 }
68
 
67
 
69
 -(BOOL)isCustomTransitioned {
68
 -(BOOL)isCustomTransitioned {
70
-	return self.animator != nil;
69
+	return self.options.customTransition != nil;
71
 }
70
 }
72
 
71
 
73
 - (BOOL)isAnimated {
72
 - (BOOL)isAnimated {

+ 10
- 0
lib/ios/RNNTransitionOptions.h View File

1
+#import "RNNOptions.h"
2
+
3
+@interface RNNTransitionOptions : RNNOptions
4
+
5
+@property (nonatomic, strong) NSArray* animations;
6
+@property (nonatomic, strong) NSNumber* duration;
7
+@property (nonatomic, strong) NSNumber* springDamping;
8
+@property (nonatomic, strong) NSNumber* springVelocity;
9
+
10
+@end

+ 29
- 0
lib/ios/RNNTransitionOptions.m View File

1
+#import "RNNTransitionOptions.h"
2
+
3
+#define DEFAULT_DURATION @(0.7)
4
+#define DEFAULT_SPRING_VELOCITY @(0.8)
5
+#define DEFAULT_SPRING_DAMPING @(0.85)
6
+
7
+@implementation RNNTransitionOptions
8
+
9
+- (instancetype)initWithDict:(NSDictionary *)dict {
10
+	if (!dict[@"animations"]) {
11
+		return nil;
12
+	}
13
+	
14
+	return [super initWithDict:dict];
15
+}
16
+
17
+- (NSNumber *)duration {
18
+	return _duration ? _duration : DEFAULT_DURATION;
19
+}
20
+
21
+- (NSNumber *)springVelocity {
22
+	return _springVelocity ? _springVelocity : DEFAULT_SPRING_VELOCITY;
23
+}
24
+
25
+- (NSNumber *)springDamping {
26
+	return _springDamping ? _springDamping : DEFAULT_SPRING_DAMPING;
27
+}
28
+
29
+@end

+ 8
- 0
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj View File

71
 		504AFE751FFFF0540076E904 /* RNNTopTabsOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 504AFE731FFFF0540076E904 /* RNNTopTabsOptions.m */; };
71
 		504AFE751FFFF0540076E904 /* RNNTopTabsOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 504AFE731FFFF0540076E904 /* RNNTopTabsOptions.m */; };
72
 		504AFE761FFFF1E00076E904 /* RNNNavigationOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E83BAD691F27362500A9F3DD /* RNNNavigationOptions.h */; };
72
 		504AFE761FFFF1E00076E904 /* RNNNavigationOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E83BAD691F27362500A9F3DD /* RNNNavigationOptions.h */; };
73
 		504AFE771FFFF1E20076E904 /* RNNTopBarOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = A7626BFE1FC2FB6700492FB8 /* RNNTopBarOptions.h */; };
73
 		504AFE771FFFF1E20076E904 /* RNNTopBarOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = A7626BFE1FC2FB6700492FB8 /* RNNTopBarOptions.h */; };
74
+		507E7D57201DDD3000444E6C /* RNNTransitionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 507E7D55201DDD3000444E6C /* RNNTransitionOptions.h */; };
75
+		507E7D58201DDD3000444E6C /* RNNTransitionOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 507E7D56201DDD3000444E6C /* RNNTransitionOptions.m */; };
74
 		507F43C51FF4F17C00D9425B /* RNNTopTabsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 507F43C31FF4F17C00D9425B /* RNNTopTabsViewController.h */; };
76
 		507F43C51FF4F17C00D9425B /* RNNTopTabsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 507F43C31FF4F17C00D9425B /* RNNTopTabsViewController.h */; };
75
 		507F43C61FF4F17C00D9425B /* RNNTopTabsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 507F43C41FF4F17C00D9425B /* RNNTopTabsViewController.m */; };
77
 		507F43C61FF4F17C00D9425B /* RNNTopTabsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 507F43C41FF4F17C00D9425B /* RNNTopTabsViewController.m */; };
76
 		507F43C91FF4F9CC00D9425B /* RNNTopTabOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 507F43C71FF4F9CC00D9425B /* RNNTopTabOptions.h */; };
78
 		507F43C91FF4F9CC00D9425B /* RNNTopTabOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 507F43C71FF4F9CC00D9425B /* RNNTopTabOptions.h */; };
244
 		504AFE631FFE53070076E904 /* RNNOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNOptions.m; sourceTree = "<group>"; };
246
 		504AFE631FFE53070076E904 /* RNNOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNOptions.m; sourceTree = "<group>"; };
245
 		504AFE721FFFF0540076E904 /* RNNTopTabsOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTopTabsOptions.h; sourceTree = "<group>"; };
247
 		504AFE721FFFF0540076E904 /* RNNTopTabsOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTopTabsOptions.h; sourceTree = "<group>"; };
246
 		504AFE731FFFF0540076E904 /* RNNTopTabsOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNTopTabsOptions.m; sourceTree = "<group>"; };
248
 		504AFE731FFFF0540076E904 /* RNNTopTabsOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNTopTabsOptions.m; sourceTree = "<group>"; };
249
+		507E7D55201DDD3000444E6C /* RNNTransitionOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTransitionOptions.h; sourceTree = "<group>"; };
250
+		507E7D56201DDD3000444E6C /* RNNTransitionOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNTransitionOptions.m; sourceTree = "<group>"; };
247
 		507F43C31FF4F17C00D9425B /* RNNTopTabsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTopTabsViewController.h; sourceTree = "<group>"; };
251
 		507F43C31FF4F17C00D9425B /* RNNTopTabsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTopTabsViewController.h; sourceTree = "<group>"; };
248
 		507F43C41FF4F17C00D9425B /* RNNTopTabsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNTopTabsViewController.m; sourceTree = "<group>"; };
252
 		507F43C41FF4F17C00D9425B /* RNNTopTabsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNTopTabsViewController.m; sourceTree = "<group>"; };
249
 		507F43C71FF4F9CC00D9425B /* RNNTopTabOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTopTabOptions.h; sourceTree = "<group>"; };
253
 		507F43C71FF4F9CC00D9425B /* RNNTopTabOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTopTabOptions.h; sourceTree = "<group>"; };
469
 				50CB3B681FDE911400AA153B /* RNNSideMenuOptions.m */,
473
 				50CB3B681FDE911400AA153B /* RNNSideMenuOptions.m */,
470
 				50A00C35200F84D6000F01A6 /* RNNOverlayOptions.h */,
474
 				50A00C35200F84D6000F01A6 /* RNNOverlayOptions.h */,
471
 				50A00C36200F84D6000F01A6 /* RNNOverlayOptions.m */,
475
 				50A00C36200F84D6000F01A6 /* RNNOverlayOptions.m */,
476
+				507E7D55201DDD3000444E6C /* RNNTransitionOptions.h */,
477
+				507E7D56201DDD3000444E6C /* RNNTransitionOptions.m */,
472
 			);
478
 			);
473
 			name = Options;
479
 			name = Options;
474
 			sourceTree = "<group>";
480
 			sourceTree = "<group>";
723
 				E8A5CD621F49114F00E89D0D /* RNNElement.h in Headers */,
729
 				E8A5CD621F49114F00E89D0D /* RNNElement.h in Headers */,
724
 				504AFE741FFFF0540076E904 /* RNNTopTabsOptions.h in Headers */,
730
 				504AFE741FFFF0540076E904 /* RNNTopTabsOptions.h in Headers */,
725
 				E8E5182E1F83A48B000467AC /* RNNTransitionStateHolder.h in Headers */,
731
 				E8E5182E1F83A48B000467AC /* RNNTransitionStateHolder.h in Headers */,
732
+				507E7D57201DDD3000444E6C /* RNNTransitionOptions.h in Headers */,
726
 				2DCD9195200014A900EDC75D /* RNNBridgeManager.h in Headers */,
733
 				2DCD9195200014A900EDC75D /* RNNBridgeManager.h in Headers */,
727
 				7B1126A91E2D2B6C00F9B03B /* RNNControllerFactory.h in Headers */,
734
 				7B1126A91E2D2B6C00F9B03B /* RNNControllerFactory.h in Headers */,
728
 				263905D61E4C94970023D7D3 /* RNNSideMenuController.h in Headers */,
735
 				263905D61E4C94970023D7D3 /* RNNSideMenuController.h in Headers */,
870
 				263905BA1E4C6F440023D7D3 /* RCCDrawerController.m in Sources */,
877
 				263905BA1E4C6F440023D7D3 /* RCCDrawerController.m in Sources */,
871
 				50F5DFC21F407A8C001A00BC /* RNNTabBarController.m in Sources */,
878
 				50F5DFC21F407A8C001A00BC /* RNNTabBarController.m in Sources */,
872
 				263905BC1E4C6F440023D7D3 /* RCCDrawerHelper.m in Sources */,
879
 				263905BC1E4C6F440023D7D3 /* RCCDrawerHelper.m in Sources */,
880
+				507E7D58201DDD3000444E6C /* RNNTransitionOptions.m in Sources */,
873
 				2145452A1F4DC85F006E8DA1 /* RCTHelpers.m in Sources */,
881
 				2145452A1F4DC85F006E8DA1 /* RCTHelpers.m in Sources */,
874
 				2DCD9196200014A900EDC75D /* RNNBridgeManager.m in Sources */,
882
 				2DCD9196200014A900EDC75D /* RNNBridgeManager.m in Sources */,
875
 				263905C11E4C6F440023D7D3 /* SidebarAirbnbAnimation.m in Sources */,
883
 				263905C11E4C6F440023D7D3 /* SidebarAirbnbAnimation.m in Sources */,

+ 1
- 2
lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m View File

68
 																withOptions:initialOptions
68
 																withOptions:initialOptions
69
 															withComponentId:@"componentId"
69
 															withComponentId:@"componentId"
70
 															rootViewCreator:[[RNNTestRootViewCreator alloc] init]
70
 															rootViewCreator:[[RNNTestRootViewCreator alloc] init]
71
-															   eventEmitter:nil
72
-																   animator:nil];
71
+															   eventEmitter:nil];
73
 	RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:vc];
72
 	RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:vc];
74
 	[vc viewWillAppear:false];
73
 	[vc viewWillAppear:false];
75
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
74
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);

+ 1
- 1
lib/ios/ReactNativeNavigationTests/RNNNavigationStackManagerTest.m View File

53
 
53
 
54
 
54
 
55
 - (void)testPop_removeTopVCFromStore {
55
 - (void)testPop_removeTopVCFromStore {
56
-	[self.uut pop:@"vc3" withAnimationData:(NSDictionary*)nil];
56
+	[self.uut pop:@"vc3" withTransitionOptions:nil];
57
 	XCTAssertNil([self.store findComponentForId:@"vc3"]);
57
 	XCTAssertNil([self.store findComponentForId:@"vc3"]);
58
 	XCTAssertNotNil([self.store findComponentForId:@"vc2"]);
58
 	XCTAssertNotNil([self.store findComponentForId:@"vc2"]);
59
 	XCTAssertNotNil([self.store findComponentForId:@"vc1"]);
59
 	XCTAssertNotNil([self.store findComponentForId:@"vc1"]);

+ 1
- 1
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m View File

42
 	self.componentId = @"cntId";
42
 	self.componentId = @"cntId";
43
 	self.emitter = nil;
43
 	self.emitter = nil;
44
 	self.options = [RNNNavigationOptions new];
44
 	self.options = [RNNNavigationOptions new];
45
-	self.uut = [[RNNRootViewController alloc] initWithName:self.pageName withOptions:self.options withComponentId:self.componentId rootViewCreator:self.creator eventEmitter:self.emitter animator:nil];
45
+	self.uut = [[RNNRootViewController alloc] initWithName:self.pageName withOptions:self.options withComponentId:self.componentId rootViewCreator:self.creator eventEmitter:self.emitter];
46
 }
46
 }
47
 
47
 
48
 -(void)testTopBarBackgroundColor_validColor{
48
 -(void)testTopBarBackgroundColor_validColor{

+ 12
- 13
playground/src/screens/CustomTransitionOrigin.js View File

54
     Navigation.push(this.props.componentId, {
54
     Navigation.push(this.props.componentId, {
55
       component: {
55
       component: {
56
         name: 'navigation.playground.CustomTransitionDestination',
56
         name: 'navigation.playground.CustomTransitionDestination',
57
-        customTransition: {
58
-          animations: [
59
-            { type: 'sharedElement', fromId: 'title1', toId: 'title2', startDelay: 0, springVelocity: 0.2, duration: 0.5 },
60
-            {
61
-              type: 'sharedElement', fromId: 'image1', toId: 'customDestinationImage', startDelay: 0, springVelocity: 0.9,
62
-              springDamping: 0.9, duration: 0.8, interactivePop: true
63
-            },
64
-            { type: 'sharedElement', fromId: 'image2', toId: 'customDestinationImage2', startDelay: 0, duration: 0.8 },
65
-            { fromId: 'image4', endY: 50, endX: 50, endAlpha: 0, startDelay: 0, duration: 0.8, springVelocity: 0.5 },
66
-            { fromId: 'customDestinationParagraph', startY: 50, startAlpha: 0, endAlpha: 1, startDelay: 0, duration: 0.8 }
67
-
68
-          ],
69
-          duration: 0.8
57
+        options: {
58
+          customTransition: {
59
+            animations: [
60
+              { type: 'sharedElement', fromId: 'title1', toId: 'title2', startDelay: 0, springVelocity: 0.2, duration: 0.5 },
61
+              { type: 'sharedElement', fromId: 'image1', toId: 'customDestinationImage', startDelay: 0, springVelocity: 0.9,
62
+              springDamping: 0.9, duration: 0.8, interactivePop: true },
63
+              { type: 'sharedElement', fromId: 'image2', toId: 'customDestinationImage2', startDelay: 0, duration: 0.8 },
64
+              { fromId: 'image4', endY: 50, endX: 50, endAlpha: 0, startDelay: 0, duration: 0.8, springVelocity: 0.5 },
65
+              { fromId: 'customDestinationParagraph', startY: 50, startAlpha: 0, endAlpha: 1, startDelay: 0, duration: 0.8 }
66
+            ],
67
+            duration: 0.8
68
+          }
70
         }
69
         }
71
       }
70
       }
72
     });
71
     });