Kaynağa Gözat

waitForRender animation options

yogevbd 6 yıl önce
ebeveyn
işleme
fba6fc572e

+ 2
- 2
lib/ios/RNNCommandsHandler.m Dosyayı Görüntüle

128
 			[rootVc registerForPreviewingWithDelegate:(id)rootVc sourceView:elementView];
128
 			[rootVc registerForPreviewingWithDelegate:(id)rootVc sourceView:elementView];
129
 		}
129
 		}
130
 	} else {
130
 	} else {
131
-		[newVc onReactViewReady:^{
132
-			id animationDelegate = (newVc.options.animations.push.hasCustomAnimation || newVc.isCustomTransitioned) ? newVc : nil;
131
+		id animationDelegate = (newVc.options.animations.push.hasCustomAnimation || newVc.isCustomTransitioned) ? newVc : nil;
132
+		[newVc waitForReactViewRender:newVc.options.animations.push.waitForRender perform:^{
133
 			[_stackManager push:newVc onTop:fromVC animated:newVc.options.animations.push.enable animationDelegate:animationDelegate completion:^{
133
 			[_stackManager push:newVc onTop:fromVC animated:newVc.options.animations.push.enable animationDelegate:animationDelegate completion:^{
134
 				[_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
134
 				[_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
135
 				completion();
135
 				completion();

+ 4
- 8
lib/ios/RNNModalManager.m Dosyayı Görüntüle

12
 	_store = store;
12
 	_store = store;
13
 	return self;
13
 	return self;
14
 }
14
 }
15
--(void)waitForContentToAppearAndThen:(SEL)nameOfSelector {
16
-	[[NSNotificationCenter defaultCenter] addObserver:self
17
-											 selector:nameOfSelector
18
-												 name: @"RCTContentDidAppearNotification"
19
-											   object:nil];
20
-}
21
 
15
 
22
 -(void)showModalAfterLoad:(NSDictionary*)notif {
16
 -(void)showModalAfterLoad:(NSDictionary*)notif {
23
-	[[NSNotificationCenter defaultCenter] removeObserver:self name:@"RCTContentDidAppearNotification" object:nil];
24
 	RNNRootViewController *topVC = (RNNRootViewController*)[self topPresentedVC];
17
 	RNNRootViewController *topVC = (RNNRootViewController*)[self topPresentedVC];
25
 	topVC.definesPresentationContext = YES;
18
 	topVC.definesPresentationContext = YES;
26
 	
19
 	
27
 	if (topVC.options.animations.showModal.hasCustomAnimation) {
20
 	if (topVC.options.animations.showModal.hasCustomAnimation) {
28
 		self.toVC.transitioningDelegate = topVC;
21
 		self.toVC.transitioningDelegate = topVC;
29
 	}
22
 	}
23
+	
30
 	[topVC presentViewController:self.toVC animated:self.toVC.options.animations.showModal.enable completion:^{
24
 	[topVC presentViewController:self.toVC animated:self.toVC.options.animations.showModal.enable completion:^{
31
 		if (_completionBlock) {
25
 		if (_completionBlock) {
32
 			_completionBlock();
26
 			_completionBlock();
49
     ) {
43
     ) {
50
 		[self showModalAfterLoad:nil];
44
 		[self showModalAfterLoad:nil];
51
 	} else {
45
 	} else {
52
-		[self waitForContentToAppearAndThen:@selector(showModalAfterLoad:)];
46
+		[self.toVC waitForReactViewRender:self.toVC.options.animations.showModal.waitForRender perform:^{
47
+			[self showModalAfterLoad:nil];
48
+		}];
53
 	}
49
 	}
54
 }
50
 }
55
 
51
 

+ 8
- 0
lib/ios/RNNNavigationController.m Dosyayı Görüntüle

36
 	[self.getTopViewController applyModalOptions];
36
 	[self.getTopViewController applyModalOptions];
37
 }
37
 }
38
 
38
 
39
+- (UIViewController *)popViewControllerAnimated:(BOOL)animated {
40
+	return [super popViewControllerAnimated:animated];
41
+}
42
+
39
 - (NSString *)componentId {
43
 - (NSString *)componentId {
40
 	return _componentId ? _componentId : self.getTopViewController.componentId;
44
 	return _componentId ? _componentId : self.getTopViewController.componentId;
41
 }
45
 }
52
 	return self.getTopViewController.options;
56
 	return self.getTopViewController.options;
53
 }
57
 }
54
 
58
 
59
+- (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock {
60
+	[self.getTopViewController waitForReactViewRender:wait perform:readyBlock];
61
+}
62
+
55
 - (UIViewController *)childViewControllerForStatusBarStyle {
63
 - (UIViewController *)childViewControllerForStatusBarStyle {
56
 	return self.topViewController;
64
 	return self.topViewController;
57
 }
65
 }

+ 0
- 4
lib/ios/RNNRootViewController.h Dosyayı Görüntüle

11
 
11
 
12
 @class RNNRootViewController;
12
 @class RNNRootViewController;
13
 
13
 
14
-typedef void (^RNNReactViewReadyCompletionBlock)(void);
15
-
16
 @interface RNNRootViewController : UIViewController	<RNNRootViewProtocol, UIViewControllerPreviewingDelegate, UISearchResultsUpdating, UISearchBarDelegate>
14
 @interface RNNRootViewController : UIViewController	<RNNRootViewProtocol, UIViewControllerPreviewingDelegate, UISearchResultsUpdating, UISearchBarDelegate>
17
 
15
 
18
 @property (nonatomic, strong) RNNNavigationOptions* options;
16
 @property (nonatomic, strong) RNNNavigationOptions* options;
31
 			   eventEmitter:(RNNEventEmitter*)eventEmitter
29
 			   eventEmitter:(RNNEventEmitter*)eventEmitter
32
 		  isExternalComponent:(BOOL)isExternalComponent;
30
 		  isExternalComponent:(BOOL)isExternalComponent;
33
 
31
 
34
-- (void)onReactViewReady:(RNNReactViewReadyCompletionBlock)readyBlock;
35
-
36
 -(void)applyTabBarItem;
32
 -(void)applyTabBarItem;
37
 -(void)applyTopTabsOptions;
33
 -(void)applyTopTabsOptions;
38
 
34
 

+ 8
- 0
lib/ios/RNNRootViewController.m Dosyayı Görüntüle

91
 	[[NSNotificationCenter defaultCenter] removeObserver:self name:@"RCTContentDidAppearNotification" object:nil];
91
 	[[NSNotificationCenter defaultCenter] removeObserver:self name:@"RCTContentDidAppearNotification" object:nil];
92
 }
92
 }
93
 
93
 
94
+- (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock {
95
+	if (wait) {
96
+		[self onReactViewReady:readyBlock];
97
+	} else {
98
+		readyBlock();
99
+	}
100
+}
101
+
94
 - (void)onReactViewReady:(RNNReactViewReadyCompletionBlock)readyBlock {
102
 - (void)onReactViewReady:(RNNReactViewReadyCompletionBlock)readyBlock {
95
 	if (self.isCustomViewController) {
103
 	if (self.isCustomViewController) {
96
 		readyBlock();
104
 		readyBlock();

+ 2
- 0
lib/ios/RNNRootViewProtocol.h Dosyayı Görüntüle

1
 #import "RNNNavigationOptions.h"
1
 #import "RNNNavigationOptions.h"
2
+typedef void (^RNNReactViewReadyCompletionBlock)(void);
2
 
3
 
3
 @protocol RNNRootViewProtocol <NSObject, UINavigationControllerDelegate, UIViewControllerTransitioningDelegate, UISplitViewControllerDelegate>
4
 @protocol RNNRootViewProtocol <NSObject, UINavigationControllerDelegate, UIViewControllerTransitioningDelegate, UISplitViewControllerDelegate>
4
 
5
 
13
 
14
 
14
 @required
15
 @required
15
 - (NSString *)componentId;
16
 - (NSString *)componentId;
17
+- (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock;
16
 
18
 
17
 @end
19
 @end
18
 
20
 

+ 1
- 0
lib/ios/RNNScreenTransition.h Dosyayı Görüntüle

8
 @property (nonatomic, strong) RNNTransitionStateHolder* bottomTabs;
8
 @property (nonatomic, strong) RNNTransitionStateHolder* bottomTabs;
9
 
9
 
10
 @property (nonatomic) BOOL enable;
10
 @property (nonatomic) BOOL enable;
11
+@property (nonatomic) BOOL waitForRender;
11
 
12
 
12
 - (BOOL)hasCustomAnimation;
13
 - (BOOL)hasCustomAnimation;
13
 
14
 

+ 1
- 0
lib/ios/RNNScreenTransition.m Dosyayı Görüntüle

10
 	self.bottomTabs = dict[@"bottomTabs"] ? [[RNNTransitionStateHolder alloc] initWithDict:dict[@"bottomTabs"]] : nil;
10
 	self.bottomTabs = dict[@"bottomTabs"] ? [[RNNTransitionStateHolder alloc] initWithDict:dict[@"bottomTabs"]] : nil;
11
 
11
 
12
 	self.enable = dict[@"enabled"] ? [dict[@"enabled"] boolValue] : YES;
12
 	self.enable = dict[@"enabled"] ? [dict[@"enabled"] boolValue] : YES;
13
+	self.waitForRender = dict[@"waitForRender"] ? [dict[@"waitForRender"] boolValue] : NO;
13
 
14
 
14
 	return self;
15
 	return self;
15
 }
16
 }

+ 4
- 0
lib/ios/RNNSideMenuChildVC.m Dosyayı Görüntüle

35
 	[self.child mergeOptions:options];
35
 	[self.child mergeOptions:options];
36
 }
36
 }
37
 
37
 
38
+- (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock {
39
+	[self.child waitForReactViewRender:wait perform:readyBlock];
40
+}
41
+
38
 - (UIStatusBarStyle)preferredStatusBarStyle {
42
 - (UIStatusBarStyle)preferredStatusBarStyle {
39
 	return self.child.preferredStatusBarStyle;
43
 	return self.child.preferredStatusBarStyle;
40
 }
44
 }

+ 4
- 0
lib/ios/RNNSideMenuController.m Dosyayı Görüntüle

93
 	[self.center mergeOptions:options];
93
 	[self.center mergeOptions:options];
94
 }
94
 }
95
 
95
 
96
+- (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock {
97
+	[self.center waitForReactViewRender:wait perform:readyBlock];
98
+}
99
+
96
 - (NSString *)componentId {
100
 - (NSString *)componentId {
97
 	return _center.componentId;
101
 	return _center.componentId;
98
 }
102
 }

+ 4
- 0
lib/ios/RNNSplitViewController.m Dosyayı Görüntüle

33
 - (void)optionsUpdated {
33
 - (void)optionsUpdated {
34
 }
34
 }
35
 
35
 
36
+- (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock {
37
+	readyBlock();
38
+}
39
+
36
 - (void)mergeOptions:(RNNOptions *)options {
40
 - (void)mergeOptions:(RNNOptions *)options {
37
 	[self.options mergeOptions:options];
41
 	[self.options mergeOptions:options];
38
 }
42
 }

+ 4
- 0
lib/ios/RNNTabBarController.m Dosyayı Görüntüle

45
 	[((UIViewController<RNNRootViewProtocol>*)self.selectedViewController) mergeOptions:options];
45
 	[((UIViewController<RNNRootViewProtocol>*)self.selectedViewController) mergeOptions:options];
46
 }
46
 }
47
 
47
 
48
+- (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock {
49
+	[((UIViewController<RNNRootViewProtocol>*)self.selectedViewController) waitForReactViewRender:wait perform:readyBlock];
50
+}
51
+
48
 - (RNNNavigationOptions *)options {
52
 - (RNNNavigationOptions *)options {
49
 	return [((UIViewController<RNNRootViewProtocol>*)self.selectedViewController) options];
53
 	return [((UIViewController<RNNRootViewProtocol>*)self.selectedViewController) options];
50
 }
54
 }

+ 4
- 0
lib/ios/RNNTopTabsViewController.m Dosyayı Görüntüle

76
 	return _currentViewController.componentId;
76
 	return _currentViewController.componentId;
77
 }
77
 }
78
 
78
 
79
+- (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock {
80
+	[_currentViewController waitForReactViewRender:wait perform:readyBlock];
81
+}
82
+
79
 @end
83
 @end