Browse Source

removed componentLifecycle events and navigationCommands event (#2636)

yogevbd 6 years ago
parent
commit
95f2560414
No account linked to committer's email address

+ 0
- 9
lib/ios/RNNCommandsHandler.m View File

@@ -65,7 +65,6 @@
65 65
 	
66 66
 	UIViewController<RNNRootViewProtocol> *newVc = [_controllerFactory createLayoutAndSaveToStore:layout];
67 67
 	[_navigationStackManager push:newVc onTop:componentId completion:^{
68
-		[_controllerFactory.eventEmitter sendNavigationEvent:[RNNNavigationEvent create:kPush fromComponent:componentId toComponent:newVc.componentId]];
69 68
 		completion();
70 69
 	}];
71 70
 }
@@ -74,7 +73,6 @@
74 73
 	[self assertReady];
75 74
 	[CATransaction begin];
76 75
 	[CATransaction setCompletionBlock:^{
77
-		[_controllerFactory.eventEmitter sendNavigationEvent:[RNNNavigationEvent create:kPop fromComponent:nil toComponent:componentId]];
78 76
 		completion();
79 77
 	}];
80 78
 	
@@ -97,7 +95,6 @@
97 95
 	[self assertReady];
98 96
 	[CATransaction begin];
99 97
 	[CATransaction setCompletionBlock:^{
100
-		[_controllerFactory.eventEmitter sendNavigationEvent:[RNNNavigationEvent create:kPopTo fromComponent:nil toComponent:componentId]];
101 98
 		completion();
102 99
 	}];
103 100
 	
@@ -110,7 +107,6 @@
110 107
 	[self assertReady];
111 108
 	[CATransaction begin];
112 109
 	[CATransaction setCompletionBlock:^{
113
-		[_controllerFactory.eventEmitter sendNavigationEvent:[RNNNavigationEvent create:kPopToRoot fromComponent:componentId toComponent:nil]];
114 110
 		completion();
115 111
 	}];
116 112
 	
@@ -124,7 +120,6 @@
124 120
 	
125 121
 	UIViewController<RNNRootViewProtocol> *newVc = [_controllerFactory createLayoutAndSaveToStore:layout];
126 122
 	[_modalManager showModal:newVc completion:^{
127
-		[_controllerFactory.eventEmitter sendNavigationEvent:[RNNNavigationEvent create:kShowModal fromComponent:nil toComponent:newVc.componentId]];
128 123
 		completion();
129 124
 	}];
130 125
 }
@@ -133,7 +128,6 @@
133 128
 	[self assertReady];
134 129
 	[CATransaction begin];
135 130
 	[CATransaction setCompletionBlock:^{
136
-		[_controllerFactory.eventEmitter sendNavigationEvent:[RNNNavigationEvent create:kDismissModal fromComponent:componentId toComponent:nil]];
137 131
 		completion();
138 132
 	}];
139 133
 	
@@ -146,7 +140,6 @@
146 140
 	[self assertReady];
147 141
 	[CATransaction begin];
148 142
 	[CATransaction setCompletionBlock:^{
149
-		[_controllerFactory.eventEmitter sendNavigationEvent:[RNNNavigationEvent create:kDismissAllModals fromComponent:nil toComponent:nil]];
150 143
 		completion();
151 144
 	}];
152 145
 	
@@ -159,7 +152,6 @@
159 152
 	[self assertReady];
160 153
 	UIViewController<RNNRootViewProtocol>* overlayVC = [_controllerFactory createOverlay:layout];
161 154
 	[_overlayManager showOverlay:overlayVC completion:^{
162
-		[_controllerFactory.eventEmitter sendNavigationEvent:[RNNNavigationEvent create:kShowOverlay fromComponent:nil toComponent:overlayVC.componentId]];
163 155
 		completion();
164 156
 	}];
165 157
 }
@@ -167,7 +159,6 @@
167 159
 - (void)dismissOverlay:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
168 160
 	[self assertReady];
169 161
 	[_overlayManager dismissOverlay:componentId completion:^{	
170
-		[_controllerFactory.eventEmitter sendNavigationEvent:[RNNNavigationEvent create:kDismissOverlay fromComponent:componentId toComponent:nil]];
171 162
 		completion();
172 163
 	}];
173 164
 }

+ 0
- 3
lib/ios/RNNEventEmitter.h View File

@@ -5,7 +5,6 @@
5 5
 #import <React/RCTBridgeModule.h>
6 6
 
7 7
 #import "RNNNavigationEvent.h"
8
-#import "RNNComponentLifecycleEvent.h"
9 8
 
10 9
 @interface RNNEventEmitter : RCTEventEmitter <RCTBridgeModule>
11 10
 
@@ -19,6 +18,4 @@
19 18
 
20 19
 -(void)sendNavigationEvent:(RNNNavigationEvent*)navigationEvent;
21 20
 
22
--(void)sendLifecycleEvent:(RNNComponentLifecycleEvent *)navigationEvent;
23
-
24 21
 @end

+ 1
- 6
lib/ios/RNNEventEmitter.m View File

@@ -12,10 +12,9 @@ static NSString* const componentDidAppear	= @"RNN.componentDidAppear";
12 12
 static NSString* const componentDidDisappear	= @"RNN.componentDidDisappear";
13 13
 static NSString* const onNavigationButtonPressed	= @"RNN.navigationButtonPressed";
14 14
 static NSString* const navigationCommands	= @"RNN.navigationCommands";
15
-static NSString* const componentLifecycle	= @"RNN.componentLifecycle";
16 15
 
17 16
 -(NSArray<NSString *> *)supportedEvents {
18
-	return @[onAppLaunched, componentDidAppear, componentDidDisappear, onNavigationButtonPressed, navigationCommands, componentLifecycle];
17
+	return @[onAppLaunched, componentDidAppear, componentDidDisappear, onNavigationButtonPressed, navigationCommands];
19 18
 }
20 19
 
21 20
 # pragma mark public
@@ -32,10 +31,6 @@ static NSString* const componentLifecycle	= @"RNN.componentLifecycle";
32 31
 	[self send:navigationCommands body:navigationEvent.body];
33 32
 }
34 33
 
35
--(void)sendLifecycleEvent:(RNNComponentLifecycleEvent *)navigationEvent {
36
-	[self send:componentLifecycle body:navigationEvent.body];
37
-}
38
-
39 34
 -(void)sendComponentDidAppear:(NSString *)componentId {
40 35
 	[self send:componentDidAppear body:componentId];
41 36
 }

+ 0
- 8
lib/ios/RNNRootViewController.m View File

@@ -37,34 +37,26 @@
37 37
 -(void)viewWillAppear:(BOOL)animated{
38 38
 	[super viewWillAppear:animated];
39 39
 	[self.options applyOn:self];
40
-	[self sendLifecycleEvent:kDidMount];
41 40
 }
42 41
 
43 42
 -(void)viewDidAppear:(BOOL)animated {
44 43
 	[super viewDidAppear:animated];
45 44
 	[self.eventEmitter sendComponentDidAppear:self.componentId];
46
-	[self sendLifecycleEvent:kDidAppear];
47 45
 }
48 46
 
49 47
 - (void)viewWillDisappear:(BOOL)animated {
50 48
 	[super viewWillDisappear:animated];
51
-	[self sendLifecycleEvent:kWillUnmount];
52 49
 }
53 50
 
54 51
 -(void)viewDidDisappear:(BOOL)animated {
55 52
 	[super viewDidDisappear:animated];
56 53
 	[self.eventEmitter sendComponentDidDisappear:self.componentId];
57
-	[self sendLifecycleEvent:kDidDisappear];
58 54
 }
59 55
 
60 56
 - (void)viewDidLoad {
61 57
 	[super viewDidLoad];
62 58
 }
63 59
 
64
-- (void)sendLifecycleEvent:(LifecycleEvent)event {
65
-	[self.eventEmitter sendLifecycleEvent:[RNNComponentLifecycleEvent create:event componentName:self.componentName componentId:self.componentId]];
66
-}
67
-
68 60
 -(BOOL)isCustomTransitioned {
69 61
 	return self.options.customTransition != nil;
70 62
 }