Browse Source

refactored animated prop

yogevbd 6 years ago
parent
commit
d40503670a

+ 1
- 1
lib/ios/RNNAnimator.m View File

33
 -(NSArray*)prepareSharedElementTransitionWithComponentView:(UIView*)componentView {
33
 -(NSArray*)prepareSharedElementTransitionWithComponentView:(UIView*)componentView {
34
 	NSMutableArray* transitions = [NSMutableArray new];
34
 	NSMutableArray* transitions = [NSMutableArray new];
35
 	for (NSDictionary* transition in self.transitionOptions.animations) {
35
 	for (NSDictionary* transition in self.transitionOptions.animations) {
36
-		RNNTransitionStateHolder* transitionStateHolder = [[RNNTransitionStateHolder alloc] initWithTransition:transition];
36
+		RNNTransitionStateHolder* transitionStateHolder = [[RNNTransitionStateHolder alloc] initWithDict:transition];
37
 		RNNTransition* transition = [[RNNTransition alloc] initFromVC:self.fromVC toVC:self.toVC transitionOptions:transitionStateHolder isBackButton:self.backButton];
37
 		RNNTransition* transition = [[RNNTransition alloc] initFromVC:self.fromVC toVC:self.toVC transitionOptions:transitionStateHolder isBackButton:self.backButton];
38
 
38
 
39
 		[componentView addSubview:transition.animatedView];
39
 		[componentView addSubview:transition.animatedView];

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

22
 -(void)showModalAfterLoad:(NSDictionary*)notif {
22
 -(void)showModalAfterLoad:(NSDictionary*)notif {
23
 	[[NSNotificationCenter defaultCenter] removeObserver:self name:@"RCTContentDidAppearNotification" object:nil];
23
 	[[NSNotificationCenter defaultCenter] removeObserver:self name:@"RCTContentDidAppearNotification" object:nil];
24
 	RNNRootViewController *topVC = (RNNRootViewController*)[self topPresentedVC];
24
 	RNNRootViewController *topVC = (RNNRootViewController*)[self topPresentedVC];
25
-	if (topVC.options.animations.showModal) {
25
+	if (topVC.options.animations.showModal.hasCustomAnimation) {
26
 		self.toVC.transitioningDelegate = topVC;
26
 		self.toVC.transitioningDelegate = topVC;
27
 	}
27
 	}
28
-	[topVC presentViewController:self.toVC animated:self.toVC.isAnimated completion:^{
28
+	[topVC presentViewController:self.toVC animated:self.toVC.options.animations.showModal.enabled completion:^{
29
 		if (_completionBlock) {
29
 		if (_completionBlock) {
30
 			_completionBlock();
30
 			_completionBlock();
31
 			_completionBlock = nil;
31
 			_completionBlock = nil;
74
 	}
74
 	}
75
 	
75
 	
76
 	if (modalToDismiss == topPresentedVC || [[topPresentedVC childViewControllers] containsObject:modalToDismiss]) {
76
 	if (modalToDismiss == topPresentedVC || [[topPresentedVC childViewControllers] containsObject:modalToDismiss]) {
77
-		[modalToDismiss dismissViewControllerAnimated:modalToDismiss.isAnimated completion:^{
77
+		[modalToDismiss dismissViewControllerAnimated:modalToDismiss.options.animations.dismissModal.enabled completion:^{
78
 			[[_store pendingModalIdsToDismiss] removeObject:componentId];
78
 			[[_store pendingModalIdsToDismiss] removeObject:componentId];
79
 			[_store removeComponent:componentId];
79
 			[_store removeComponent:componentId];
80
 			[self removePendingNextModalIfOnTop];
80
 			[self removePendingNextModalIfOnTop];

+ 0
- 5
lib/ios/RNNNavigationController.m View File

16
 	return [((UIViewController<RNNRootViewProtocol>*)self.topViewController) isCustomViewController];
16
 	return [((UIViewController<RNNRootViewProtocol>*)self.topViewController) isCustomViewController];
17
 }
17
 }
18
 
18
 
19
-- (BOOL)isAnimated {
20
-	UIViewController<RNNRootViewProtocol>* rootVC = (UIViewController<RNNRootViewProtocol>*) self.topViewController;
21
-	return rootVC.isAnimated;
22
-}
23
-
24
 - (void)mergeOptions:(NSDictionary *)options {
19
 - (void)mergeOptions:(NSDictionary *)options {
25
 	[((UIViewController<RNNRootViewProtocol>*)self.topViewController) mergeOptions:options];
20
 	[((UIViewController<RNNRootViewProtocol>*)self.topViewController) mergeOptions:options];
26
 }
21
 }

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

26
 @property (nonatomic, strong) RNNTransitionsOptions* animations;
26
 @property (nonatomic, strong) RNNTransitionsOptions* animations;
27
 
27
 
28
 
28
 
29
-@property (nonatomic, strong) NSNumber* animated;
30
 @property (nonatomic, strong) NSNumber* statusBarHidden;
29
 @property (nonatomic, strong) NSNumber* statusBarHidden;
31
 @property (nonatomic, strong) NSNumber* screenBackgroundColor;
30
 @property (nonatomic, strong) NSNumber* screenBackgroundColor;
32
 @property (nonatomic, strong) NSMutableDictionary* originalTopBarImages;
31
 @property (nonatomic, strong) NSMutableDictionary* originalTopBarImages;

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

33
 	self.rootBackgroundImage = [RCTConvert UIImage:[options objectForKey:@"rootBackgroundImage"]];
33
 	self.rootBackgroundImage = [RCTConvert UIImage:[options objectForKey:@"rootBackgroundImage"]];
34
 	self.bottomTab = [[RNNBottomTabOptions alloc] initWithDict:[options objectForKey:@"bottomTab"]];
34
 	self.bottomTab = [[RNNBottomTabOptions alloc] initWithDict:[options objectForKey:@"bottomTab"]];
35
 	self.overlay = [[RNNOverlayOptions alloc] initWithDict:[options objectForKey:@"overlay"]];
35
 	self.overlay = [[RNNOverlayOptions alloc] initWithDict:[options objectForKey:@"overlay"]];
36
-	self.animated = [options objectForKey:@"animated"];
37
 	self.customTransition = [[RNNAnimationOptions alloc] initWithDict:[options objectForKey:@"customTransition"]];
36
 	self.customTransition = [[RNNAnimationOptions alloc] initWithDict:[options objectForKey:@"customTransition"]];
38
 	self.animations = [[RNNTransitionsOptions alloc] initWithDict:[options objectForKey:@"animations"]];
37
 	self.animations = [[RNNTransitionsOptions alloc] initWithDict:[options objectForKey:@"animations"]];
39
 
38
 

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

30
 	self.fromVC = vc;
30
 	self.fromVC = vc;
31
 	
31
 	
32
 	
32
 	
33
-	if (self.toVC.options.animations.push || self.toVC.isCustomTransitioned) {
33
+	if (self.toVC.options.animations.push.hasCustomAnimation || self.toVC.isCustomTransitioned) {
34
 		vc.navigationController.delegate = newTop;
34
 		vc.navigationController.delegate = newTop;
35
 	} else {
35
 	} else {
36
 		vc.navigationController.delegate = nil;
36
 		vc.navigationController.delegate = nil;
57
 		}
57
 		}
58
 	}];
58
 	}];
59
 	
59
 	
60
-	[[self.fromVC navigationController] pushViewController:self.toVC animated:self.toVC.isAnimated];
60
+	[[self.fromVC navigationController] pushViewController:self.toVC animated:self.toVC.options.animations.push.enabled];
61
 	[CATransaction commit];
61
 	[CATransaction commit];
62
 	
62
 	
63
 	self.toVC = nil;
63
 	self.toVC = nil;
71
 	if ([nvc topViewController] == vc) {
71
 	if ([nvc topViewController] == vc) {
72
 		if (vc.options.animations.pop) {
72
 		if (vc.options.animations.pop) {
73
 			nvc.delegate = vc;
73
 			nvc.delegate = vc;
74
-			[nvc popViewControllerAnimated:vc.isAnimated];
74
+			[nvc popViewControllerAnimated:vc.options.animations.pop.enabled];
75
 		} else {
75
 		} else {
76
 			nvc.delegate = nil;
76
 			nvc.delegate = nil;
77
-			[nvc popViewControllerAnimated:vc.isAnimated];
77
+			[nvc popViewControllerAnimated:vc.options.animations.pop.enabled];
78
 		}
78
 		}
79
 	} else {
79
 	} else {
80
 		NSMutableArray * vcs = nvc.viewControllers.mutableCopy;
80
 		NSMutableArray * vcs = nvc.viewControllers.mutableCopy;
81
 		[vcs removeObject:vc];
81
 		[vcs removeObject:vc];
82
-		[nvc setViewControllers:vcs animated:YES];
82
+		[nvc setViewControllers:vcs animated:vc.options.animations.pop.enabled];
83
 	}
83
 	}
84
 	[_store removeComponent:componentId];
84
 	[_store removeComponent:componentId];
85
 }
85
 }
86
 
86
 
87
 -(void)popTo:(NSString*)componentId {
87
 -(void)popTo:(NSString*)componentId {
88
-	UIViewController *vc = [_store findComponentForId:componentId];
88
+	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
89
 	
89
 	
90
 	if (vc) {
90
 	if (vc) {
91
 		UINavigationController *nvc = [vc navigationController];
91
 		UINavigationController *nvc = [vc navigationController];
92
 		if(nvc) {
92
 		if(nvc) {
93
-			NSArray *poppedVCs = [nvc popToViewController:vc animated:YES];
93
+			NSArray *poppedVCs = [nvc popToViewController:vc animated:vc.options.animations.pop.enabled];
94
 			[self removePopedViewControllers:poppedVCs];
94
 			[self removePopedViewControllers:poppedVCs];
95
 		}
95
 		}
96
 	}
96
 	}
97
 }
97
 }
98
 
98
 
99
 -(void)popToRoot:(NSString*)componentId {
99
 -(void)popToRoot:(NSString*)componentId {
100
-	UIViewController* vc = [_store findComponentForId:componentId];
100
+	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
101
 	UINavigationController* nvc = [vc navigationController];
101
 	UINavigationController* nvc = [vc navigationController];
102
-	NSArray* poppedVCs = [nvc popToRootViewControllerAnimated:YES];
102
+	NSArray* poppedVCs = [nvc popToRootViewControllerAnimated:vc.options.animations.pop.enabled];
103
 	[self removePopedViewControllers:poppedVCs];
103
 	[self removePopedViewControllers:poppedVCs];
104
 }
104
 }
105
 
105
 
113
 		}
113
 		}
114
 	}];
114
 	}];
115
 	
115
 	
116
-	[nvc setViewControllers:@[newRoot] animated:[newRoot.options.animated boolValue]];
116
+	[nvc setViewControllers:@[newRoot] animated:newRoot.options.animations.push.enabled];
117
 	
117
 	
118
 	[CATransaction commit];
118
 	[CATransaction commit];
119
 }
119
 }

+ 42
- 38
lib/ios/RNNRootViewController.m View File

5
 #import "RNNCustomTitleView.h"
5
 #import "RNNCustomTitleView.h"
6
 #import "RNNPushAnimation.h"
6
 #import "RNNPushAnimation.h"
7
 
7
 
8
-@interface RNNRootViewController()
8
+@interface RNNRootViewController() {
9
+	UIView* _customTitleView;
10
+	UIView* _customTopBar;
11
+	UIView* _customTopBarBackground;
12
+}
9
 @property (nonatomic, strong) NSString* componentName;
13
 @property (nonatomic, strong) NSString* componentName;
10
 @property (nonatomic) BOOL _statusBarHidden;
14
 @property (nonatomic) BOOL _statusBarHidden;
11
 @property (nonatomic) BOOL isExternalComponent;
15
 @property (nonatomic) BOOL isExternalComponent;
48
 
52
 
49
 -(void)viewWillAppear:(BOOL)animated{
53
 -(void)viewWillAppear:(BOOL)animated{
50
 	[super viewWillAppear:animated];
54
 	[super viewWillAppear:animated];
51
-    if (!self._optionsApplied) {
52
-        [self.options applyOn:self];
53
-    }
54
-    self._optionsApplied = true;
55
+	[self.options applyOn:self];
56
+	[self optionsUpdated];
55
 }
57
 }
56
 
58
 
57
 -(void)viewDidAppear:(BOOL)animated {
59
 -(void)viewDidAppear:(BOOL)animated {
83
 }
85
 }
84
 
86
 
85
 - (void)setCustomNavigationTitleView {
87
 - (void)setCustomNavigationTitleView {
86
-	if (self.options.topBar.title.component.name) {
87
-		RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.options.topBar.title.component];
88
-
89
-		RNNCustomTitleView *titleView = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:self.options.topBar.title.component.alignment];
90
-        reactView.backgroundColor = UIColor.clearColor;
91
-		titleView.backgroundColor = UIColor.clearColor;
92
-		self.navigationItem.titleView = titleView;
93
-	} if ([self.navigationItem.title isKindOfClass:[RNNCustomTitleView class]]) {
94
-		self.navigationItem.title = nil;
88
+	if (!_customTitleView) {
89
+		if (self.options.topBar.title.component.name) {
90
+			RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.options.topBar.title.component];
91
+			
92
+			_customTitleView = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:self.options.topBar.title.component.alignment];
93
+			reactView.backgroundColor = UIColor.clearColor;
94
+			_customTitleView.backgroundColor = UIColor.clearColor;
95
+			self.navigationItem.titleView = _customTitleView;
96
+		} if ([self.navigationItem.title isKindOfClass:[RNNCustomTitleView class]] && !_customTitleView) {
97
+			self.navigationItem.title = nil;
98
+		}
95
 	}
99
 	}
96
 }
100
 }
97
 
101
 
98
 - (void)setCustomNavigationBarView {
102
 - (void)setCustomNavigationBarView {
99
-	if (self.options.topBar.component.name) {
100
-		RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.options.topBar.component];
101
-
102
-		RNNCustomTitleView *titleView = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
103
-		reactView.backgroundColor = UIColor.clearColor;
104
-		titleView.backgroundColor = UIColor.clearColor;
105
-		[self.navigationController.navigationBar addSubview:titleView];
106
-	} else if ([[self.navigationController.navigationBar.subviews lastObject] isKindOfClass:[RNNCustomTitleView class]]) {
107
-		[[self.navigationController.navigationBar.subviews lastObject] removeFromSuperview];
103
+	if (!_customTopBar) {
104
+		if (self.options.topBar.component.name) {
105
+			RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.options.topBar.component];
106
+			
107
+			_customTopBar = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
108
+			reactView.backgroundColor = UIColor.clearColor;
109
+			_customTopBar.backgroundColor = UIColor.clearColor;
110
+			[self.navigationController.navigationBar addSubview:_customTopBar];
111
+		} else if ([[self.navigationController.navigationBar.subviews lastObject] isKindOfClass:[RNNCustomTitleView class]] && !_customTopBar) {
112
+			[[self.navigationController.navigationBar.subviews lastObject] removeFromSuperview];
113
+		}
108
 	}
114
 	}
109
 }
115
 }
110
 
116
 
111
 - (void)setCustomNavigationComponentBackground {
117
 - (void)setCustomNavigationComponentBackground {
112
-	if (self.options.topBar.background.component.name) {
113
-		RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.options.topBar.background.component];
114
-
115
-		RNNCustomTitleView *titleView = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
116
-		[self.navigationController.navigationBar insertSubview:titleView atIndex:1];
117
-		self.navigationController.navigationBar.clipsToBounds = YES;
118
-	} else if ([[self.navigationController.navigationBar.subviews objectAtIndex:1] isKindOfClass:[RNNCustomTitleView class]]) {
119
-		[[self.navigationController.navigationBar.subviews objectAtIndex:1] removeFromSuperview];
120
-		self.navigationController.navigationBar.clipsToBounds = NO;
118
+	if (!_customTopBarBackground) {
119
+		if (self.options.topBar.background.component.name) {
120
+			RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.options.topBar.background.component];
121
+			
122
+			_customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
123
+			[self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
124
+			self.navigationController.navigationBar.clipsToBounds = YES;
125
+		} else if ([[self.navigationController.navigationBar.subviews objectAtIndex:1] isKindOfClass:[RNNCustomTitleView class]]) {
126
+			[[self.navigationController.navigationBar.subviews objectAtIndex:1] removeFromSuperview];
127
+			self.navigationController.navigationBar.clipsToBounds = NO;
128
+		}
121
 	}
129
 	}
122
 }
130
 }
123
 
131
 
125
 	return self.options.customTransition.animations != nil;
133
 	return self.options.customTransition.animations != nil;
126
 }
134
 }
127
 
135
 
128
-- (BOOL)isAnimated {
129
-	return self.options.animated ? [self.options.animated boolValue] : YES;
130
-}
131
-
132
 - (BOOL)isCustomViewController {
136
 - (BOOL)isCustomViewController {
133
 	return self.isExternalComponent;
137
 	return self.isExternalComponent;
134
 }
138
 }
176
 {
180
 {
177
 	if (self.animator) {
181
 	if (self.animator) {
178
 		return self.animator;
182
 		return self.animator;
179
-	} else if (operation == UINavigationControllerOperationPush && self.options.animations.push) {
183
+	} else if (operation == UINavigationControllerOperationPush && self.options.animations.push.hasCustomAnimation) {
180
 		return [[RNNPushAnimation alloc] initWithScreenTransition:self.options.animations.push];
184
 		return [[RNNPushAnimation alloc] initWithScreenTransition:self.options.animations.push];
181
-	} else if (operation == UINavigationControllerOperationPop && self.options.animations.pop) {
185
+	} else if (operation == UINavigationControllerOperationPop && self.options.animations.pop.hasCustomAnimation) {
182
 		return [[RNNPushAnimation alloc] initWithScreenTransition:self.options.animations.pop];
186
 		return [[RNNPushAnimation alloc] initWithScreenTransition:self.options.animations.pop];
183
 	} else {
187
 	} else {
184
 		return nil;
188
 		return nil;

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

5
 @optional
5
 @optional
6
 - (void)mergeOptions:(NSDictionary*)options;
6
 - (void)mergeOptions:(NSDictionary*)options;
7
 - (BOOL)isCustomViewController;
7
 - (BOOL)isCustomViewController;
8
-- (void)optionsUpdated;
9
 - (void)performOnRotation:(void (^)(void))block;
8
 - (void)performOnRotation:(void (^)(void))block;
9
+- (void)optionsUpdated;
10
 
10
 
11
 @required
11
 @required
12
 - (BOOL)isCustomTransitioned;
12
 - (BOOL)isCustomTransitioned;
13
-- (BOOL)isAnimated;
14
 - (RNNNavigationOptions*)options;
13
 - (RNNNavigationOptions*)options;
15
 - (NSString *)componentId;
14
 - (NSString *)componentId;
16
 
15
 

+ 4
- 0
lib/ios/RNNScreenTransition.h View File

7
 @property (nonatomic, strong) RNNTransitionStateHolder* content;
7
 @property (nonatomic, strong) RNNTransitionStateHolder* content;
8
 @property (nonatomic, strong) RNNTransitionStateHolder* bottomTabs;
8
 @property (nonatomic, strong) RNNTransitionStateHolder* bottomTabs;
9
 
9
 
10
+@property (nonatomic) BOOL enabled;
11
+
12
+- (BOOL)hasCustomAnimation;
13
+
10
 @end
14
 @end

+ 11
- 4
lib/ios/RNNScreenTransition.m View File

4
 
4
 
5
 - (instancetype)initWithDict:(NSDictionary *)dict {
5
 - (instancetype)initWithDict:(NSDictionary *)dict {
6
 	self = [super init];
6
 	self = [super init];
7
-	self.topBar = [[RNNTransitionStateHolder alloc] initWithTransition:dict[@"topBar"]];
8
-	self.content = [[RNNTransitionStateHolder alloc] initWithTransition:dict[@"content"]];
9
-	self.bottomTabs = [[RNNTransitionStateHolder alloc] initWithTransition:dict[@"bottomTabs"]];
10
-	
7
+
8
+	self.topBar = dict[@"topBar"] ? [[RNNTransitionStateHolder alloc] initWithDict:dict[@"topBar"]] : nil;
9
+	self.content = dict[@"content"] ? [[RNNTransitionStateHolder alloc] initWithDict:dict[@"content"]] : nil;
10
+	self.bottomTabs = dict[@"bottomTabs"] ? [[RNNTransitionStateHolder alloc] initWithDict:dict[@"bottomTabs"]] : nil;
11
+
12
+	self.enabled = dict[@"enabled"] ? [dict[@"enabled"] boolValue] : YES;
13
+
11
 	return self;
14
 	return self;
12
 }
15
 }
13
 
16
 
17
+- (BOOL)hasCustomAnimation {
18
+	return (self.topBar || self.content || self.bottomTabs);
19
+}
20
+
14
 @end
21
 @end

+ 0
- 4
lib/ios/RNNSideMenuChildVC.m View File

37
 	return NO;
37
 	return NO;
38
 }
38
 }
39
 
39
 
40
-- (BOOL)isAnimated {
41
-	return YES;
42
-}
43
-
44
 - (RNNOptions *)options {
40
 - (RNNOptions *)options {
45
 	return nil;
41
 	return nil;
46
 }
42
 }

+ 0
- 4
lib/ios/RNNSideMenuController.m View File

76
 	return NO;
76
 	return NO;
77
 }
77
 }
78
 
78
 
79
-- (BOOL)isAnimated {
80
-	return YES;
81
-}
82
-
83
 - (RNNOptions *)options {
79
 - (RNNOptions *)options {
84
 	return nil;
80
 	return nil;
85
 }
81
 }

+ 0
- 4
lib/ios/RNNTabBarController.m View File

37
 	return NO;
37
 	return NO;
38
 }
38
 }
39
 
39
 
40
-- (BOOL)isAnimated {
41
-	return YES;
42
-}
43
-
44
 - (RNNOptions *)options {
40
 - (RNNOptions *)options {
45
 	return nil;
41
 	return nil;
46
 }
42
 }

+ 0
- 4
lib/ios/RNNTopTabsViewController.m View File

76
 	return NO;
76
 	return NO;
77
 }
77
 }
78
 
78
 
79
-- (BOOL)isAnimated {
80
-	return YES;
81
-}
82
-
83
 - (RNNOptions *)options {
79
 - (RNNOptions *)options {
84
 	return nil;
80
 	return nil;
85
 }
81
 }

+ 0
- 2
lib/ios/RNNTransitionStateHolder.h View File

20
 @property (nonatomic) double endX;
20
 @property (nonatomic) double endX;
21
 @property (nonatomic) UIViewAnimationOptions interpolation;
21
 @property (nonatomic) UIViewAnimationOptions interpolation;
22
 
22
 
23
-- (instancetype)initWithTransition:(NSDictionary*)transition;
24
-
25
 - (void)setupInitialTransitionForView:(UIView *)view;
23
 - (void)setupInitialTransitionForView:(UIView *)view;
26
 
24
 
27
 - (void)completeTransitionForView:(UIView*)view;
25
 - (void)completeTransitionForView:(UIView*)view;

+ 19
- 1
lib/ios/RNNTransitionStateHolder.m View File

8
 @end
8
 @end
9
 @implementation RNNTransitionStateHolder
9
 @implementation RNNTransitionStateHolder
10
 
10
 
11
--(instancetype)initWithTransition:(NSDictionary *)transition {
11
+-(instancetype)initWithDict:(NSDictionary *)transition {
12
 	self = [super init];
12
 	self = [super init];
13
 	
13
 	
14
 	self.springDamping = [RNNUtils getDoubleOrKey:transition withKey:@"springDamping" withDefault:0.85];
14
 	self.springDamping = [RNNUtils getDoubleOrKey:transition withKey:@"springDamping" withDefault:0.85];
31
 	return self;
31
 	return self;
32
 }
32
 }
33
 
33
 
34
+- (void)mergeWith:(NSDictionary *)transition {
35
+	self.springDamping = [RNNUtils getDoubleOrKey:transition withKey:@"springDamping" withDefault:0.85];
36
+	self.springVelocity = [RNNUtils getDoubleOrKey:transition withKey:@"springVelocity" withDefault:0.8];
37
+	self.startDelay = [RNNUtils getDoubleOrKey:transition withKey:@"startDelay" withDefault:0];
38
+	self.duration = [RNNUtils getDoubleOrKey:transition withKey:@"duration" withDefault:1];
39
+	self.startAlpha = [RNNUtils getDoubleOrKey:transition withKey:@"startAlpha" withDefault:1];
40
+	self.endAlpha = [RNNUtils getDoubleOrKey:transition withKey:@"endAlpha" withDefault:1];
41
+	self.interactivePop = [RNNUtils getBoolOrKey:transition withKey:@"interactivePop" withDefault:NO];
42
+	self.startX = [RNNUtils getDoubleOrKey:transition[@"x"] withKey:@"from" withDefault:0];
43
+	self.startY = [RNNUtils getDoubleOrKey:transition[@"y"] withKey:@"from" withDefault:0];
44
+	self.endX = [RNNUtils getDoubleOrKey:transition[@"x"] withKey:@"to" withDefault:0];
45
+	self.endY = [RNNUtils getDoubleOrKey:transition[@"y"] withKey:@"to" withDefault:0];
46
+	self.fromId = [transition objectForKey:@"fromId"];
47
+	self.toId = [transition objectForKey:@"toId"];
48
+	self.isSharedElementTransition = [[transition objectForKey:@"type"] isEqualToString:@"sharedElement"];
49
+	self.interpolation = [self animationOptionsFromString:transition[@"interpolation"]];
50
+}
51
+
34
 - (UIViewAnimationOptions)animationOptionsFromString:(NSString*)interpolationString {
52
 - (UIViewAnimationOptions)animationOptionsFromString:(NSString*)interpolationString {
35
 	if ([interpolationString isEqualToString:@"accelerate"]) {
53
 	if ([interpolationString isEqualToString:@"accelerate"]) {
36
 		return UIViewAnimationOptionCurveEaseIn;
54
 		return UIViewAnimationOptionCurveEaseIn;

+ 1
- 8
lib/ios/RNNTransitionsOptions.m View File

3
 @implementation RNNTransitionsOptions
3
 @implementation RNNTransitionsOptions
4
 
4
 
5
 - (instancetype)initWithDict:(NSDictionary *)dict {
5
 - (instancetype)initWithDict:(NSDictionary *)dict {
6
-	self = [super init];
6
+	self = [super initWithDict:dict];
7
 	
7
 	
8
 	[self mergeWith:dict];
8
 	[self mergeWith:dict];
9
 	
9
 	
10
 	return self;
10
 	return self;
11
 }
11
 }
12
 
12
 
13
-- (void)mergeWith:(NSDictionary *)otherOptions {
14
-	self.push = otherOptions[@"push"] ? [[RNNScreenTransition alloc] initWithDict:otherOptions[@"push"]] : _push;
15
-	self.pop = otherOptions[@"pop"] ? [[RNNScreenTransition alloc] initWithDict:otherOptions[@"pop"]] : _pop;
16
-	self.showModal = otherOptions[@"showModal"] ? [[RNNScreenTransition alloc] initWithDict:otherOptions[@"showModal"]] : _showModal;
17
-	self.dismissModal = otherOptions[@"dismissModal"] ? [[RNNScreenTransition alloc] initWithDict:otherOptions[@"dismissModal"]] : _dismissModal;
18
-}
19
-
20
 @end
13
 @end

+ 5
- 1
playground/src/screens/WelcomeScreen.js View File

302
       component: {
302
       component: {
303
         name: 'navigation.playground.OptionsScreen',
303
         name: 'navigation.playground.OptionsScreen',
304
         options: {
304
         options: {
305
-          animated: false
305
+          animations: {
306
+            push: {
307
+              enabled: false
308
+            }
309
+          }
306
         }
310
         }
307
       }
311
       }
308
     });
312
     });