-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
StackTransitionDelegate.m
30 lines (22 loc) · 1.42 KB
/
StackTransitionDelegate.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#import "StackTransitionDelegate.h"
#import "SharedElementTransitionsCreator.h"
#import "ElementTransitionsCreator.h"
#import "ContentTransitionCreator.h"
@implementation StackTransitionDelegate {
RNNScreenTransition* _screenTransition;
}
- (instancetype)initWithScreenTransition:(RNNScreenTransition *)screenTransition bridge:(RCTBridge *)bridge {
self = [super initWithBridge:bridge];
_screenTransition = screenTransition;
return self;
}
- (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext {
return _screenTransition.maxDuration;
}
- (NSArray *)createTransitionsFromVC:(UIViewController *)fromVC toVC:(UIViewController *)toVC containerView:(UIView *)containerView {
ContentTransitionCreator* contentTransition = [ContentTransitionCreator createTransition:_screenTransition.content view:toVC.view fromVC:fromVC toVC:toVC containerView:containerView];
NSArray* elementTransitions = [ElementTransitionsCreator create:_screenTransition.elementTransitions fromVC:fromVC toVC:toVC containerView:containerView];
NSArray* sharedElementTransitions = [SharedElementTransitionsCreator create:_screenTransition.sharedElementTransitions fromVC:fromVC toVC:toVC containerView:containerView];
return [[[NSArray arrayWithObject:contentTransition] arrayByAddingObjectsFromArray:elementTransitions] arrayByAddingObjectsFromArray:sharedElementTransitions];
}
@end