Browse Source

remove RNN.navigationEvent as it should be js-only, remove RNN.componentLifecycle

Daniel Zlotin 6 years ago
parent
commit
140f888162

+ 1
- 1
docs/_sidebar.md View File

@@ -2,4 +2,4 @@
2 2
   - [Installing](/docs/Installing)
3 3
   - [Working Locally](/docs/WorkingLocally)
4 4
   - [Usage](/docs/Usage)
5
-- API
5
+- [API](/api/README)

+ 0
- 3
lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationEvent.java View File

@@ -14,7 +14,6 @@ public class NavigationEvent {
14 14
 	private static final String componentDidAppear = "RNN.componentDidAppear";
15 15
 	private static final String componentDidDisappear = "RNN.componentDidDisappear";
16 16
 	private static final String onNavigationButtonPressed = "RNN.navigationButtonPressed";
17
-    private static final String componentLifecycle = "RNN.componentLifecycle";
18 17
 
19 18
 	private final RCTDeviceEventEmitter emitter;
20 19
 
@@ -28,12 +27,10 @@ public class NavigationEvent {
28 27
 
29 28
 	public void componentDidDisappear(String id, String componentName) {
30 29
 		emit(componentDidDisappear, id);
31
-		emit(componentLifecycle, getLifecycleEventData(id, componentName, "didDisappear"));
32 30
 	}
33 31
 
34 32
 	public void componentDidAppear(String id, String componentName) {
35 33
 		emit(componentDidAppear, id);
36
-        emit(componentLifecycle, getLifecycleEventData(id, componentName, "didAppear"));
37 34
 	}
38 35
 
39 36
     @NonNull

+ 0
- 15
lib/ios/RNNComponentLifecycleEvent.h View File

@@ -1,15 +0,0 @@
1
-#import "RNNNavigationEvent.h"
2
-
3
-#define kDidAppear         @"didAppear"
4
-#define kDidDisappear      @"didDisappear"
5
-#define kWillUnmount       @"willUnmount"
6
-#define kDidMount         @"didMount"
7
-typedef NSString*               LifecycleEvent;
8
-
9
-@interface RNNComponentLifecycleEvent : NSObject
10
-
11
-+ (instancetype)create:(LifecycleEvent)event componentName:(NSString*)componentName componentId:(NSString*)componentId;
12
-
13
-- (NSDictionary*)body;
14
-
15
-@end

+ 0
- 24
lib/ios/RNNComponentLifecycleEvent.m View File

@@ -1,24 +0,0 @@
1
-#import "RNNComponentLifecycleEvent.h"
2
-
3
-@interface RNNComponentLifecycleEvent()
4
-@property (nonatomic, strong) NSString* componentName;
5
-@property (nonatomic, strong) NSString* componentId;
6
-@property (nonatomic, strong) LifecycleEvent event;
7
-
8
-@end
9
-
10
-@implementation RNNComponentLifecycleEvent
11
-
12
-+ (instancetype)create:(LifecycleEvent)event componentName:(NSString *)componentName componentId:(NSString *)componentId {
13
-	RNNComponentLifecycleEvent* lifecycleEvent = [[RNNComponentLifecycleEvent alloc] init];
14
-	lifecycleEvent.componentName = componentName;
15
-	lifecycleEvent.componentId = componentId;
16
-	lifecycleEvent.event = event;
17
-	return lifecycleEvent;
18
-}
19
-
20
-- (NSDictionary *)body {
21
-	return @{@"event": self.event, @"componentName": self.componentName, @"componentId": self.componentId};
22
-}
23
-
24
-@end

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

@@ -4,8 +4,6 @@
4 4
 #import <React/RCTEventEmitter.h>
5 5
 #import <React/RCTBridgeModule.h>
6 6
 
7
-#import "RNNNavigationEvent.h"
8
-
9 7
 @interface RNNEventEmitter : RCTEventEmitter <RCTBridgeModule>
10 8
 
11 9
 -(void)sendOnAppLaunched;
@@ -16,6 +14,4 @@
16 14
 
17 15
 -(void)sendOnNavigationButtonPressed:(NSString*)componentId buttonId:(NSString*)buttonId;
18 16
 
19
--(void)sendNavigationEvent:(RNNNavigationEvent*)navigationEvent;
20
-
21 17
 @end

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

@@ -11,10 +11,9 @@ static NSString* const onAppLaunched	= @"RNN.appLaunched";
11 11
 static NSString* const componentDidAppear	= @"RNN.componentDidAppear";
12 12
 static NSString* const componentDidDisappear	= @"RNN.componentDidDisappear";
13 13
 static NSString* const onNavigationButtonPressed	= @"RNN.navigationButtonPressed";
14
-static NSString* const navigationCommands	= @"RNN.navigationCommands";
15 14
 
16 15
 -(NSArray<NSString *> *)supportedEvents {
17
-	return @[onAppLaunched, componentDidAppear, componentDidDisappear, onNavigationButtonPressed, navigationCommands];
16
+	return @[onAppLaunched, componentDidAppear, componentDidDisappear, onNavigationButtonPressed];
18 17
 }
19 18
 
20 19
 # pragma mark public
@@ -27,10 +26,6 @@ static NSString* const navigationCommands	= @"RNN.navigationCommands";
27 26
 	}
28 27
 }
29 28
 
30
--(void)sendNavigationEvent:(RNNNavigationEvent *)navigationEvent {
31
-	[self send:navigationCommands body:navigationEvent.body];
32
-}
33
-
34 29
 -(void)sendComponentDidAppear:(NSString *)componentId {
35 30
 	[self send:componentDidAppear body:componentId];
36 31
 }

+ 0
- 20
lib/ios/RNNNavigationEvent.h View File

@@ -1,20 +0,0 @@
1
-#import <Foundation/Foundation.h>
2
-
3
-#define kPush              @"push"
4
-#define kPop               @"pop"
5
-#define kPopTo             @"popTo"
6
-#define kPopToRoot         @"popToRoot"
7
-#define kShowModal         @"showModal"
8
-#define kDismissModal      @"dismissModal"
9
-#define kDismissAllModals  @"dismissAllModals"
10
-#define kShowOverlay       @"showOverlay"
11
-#define kDismissOverlay    @"dismissOverlay"
12
-typedef NSString*               NavigationCommand;
13
-
14
-@interface RNNNavigationEvent : NSObject
15
-
16
-@property (nonatomic, strong) NSDictionary* body;
17
-
18
-+ (instancetype)create:(NavigationCommand)commandType fromComponent:(NSString *)fromComponentId toComponent:(NSString *)toComponentId;
19
-
20
-@end

+ 0
- 26
lib/ios/RNNNavigationEvent.m View File

@@ -1,26 +0,0 @@
1
-#import "RNNNavigationEvent.h"
2
-
3
-@interface RNNNavigationEvent ()
4
-	@property (nonatomic, strong) NavigationCommand command;
5
-	@property (nonatomic, strong) NSString* toComponentId;
6
-	@property (nonatomic, strong) NSString* fromComponentId;
7
-@end
8
-
9
-@implementation RNNNavigationEvent
10
-
11
-+ (instancetype)create:(NavigationCommand)commandType fromComponent:(NSString *)fromComponentId toComponent:(NSString *)toComponentId {
12
-	RNNNavigationEvent* navigationCommand = [[RNNNavigationEvent alloc] init];
13
-	navigationCommand.command = commandType;
14
-	navigationCommand.fromComponentId = fromComponentId;
15
-	navigationCommand.toComponentId = toComponentId;
16
-	return navigationCommand;
17
-}
18
-
19
-- (NSDictionary *)body {
20
-	NSMutableDictionary* mutableParams = [NSMutableDictionary new];
21
-	self.fromComponentId ? [mutableParams setObject:self.fromComponentId forKey:@"fromComponentId"] : nil;
22
-	self.toComponentId ? [mutableParams setObject:self.toComponentId forKey:@"toComponentId"] : nil;
23
-	return @{@"commandName": self.command, @"params": mutableParams};
24
-}
25
-
26
-@end

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

@@ -63,10 +63,6 @@
63 63
 		390AD478200F499D00A8250D /* RNNSwizzles.m in Sources */ = {isa = PBXBuildFile; fileRef = 390AD476200F499D00A8250D /* RNNSwizzles.m */; };
64 64
 		5016E8EF20209690009D4F7C /* RNNCustomTitleView.h in Headers */ = {isa = PBXBuildFile; fileRef = 5016E8ED2020968F009D4F7C /* RNNCustomTitleView.h */; };
65 65
 		5016E8F020209690009D4F7C /* RNNCustomTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5016E8EE2020968F009D4F7C /* RNNCustomTitleView.m */; };
66
-		5032774E2015E86D00ECD75D /* RNNNavigationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 5032774C2015E86D00ECD75D /* RNNNavigationEvent.h */; };
67
-		5032774F2015E86D00ECD75D /* RNNNavigationEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 5032774D2015E86D00ECD75D /* RNNNavigationEvent.m */; };
68
-		503277602016302900ECD75D /* RNNComponentLifecycleEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 5032775E2016302900ECD75D /* RNNComponentLifecycleEvent.h */; };
69
-		503277612016302900ECD75D /* RNNComponentLifecycleEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 5032775F2016302900ECD75D /* RNNComponentLifecycleEvent.m */; };
70 66
 		50415CBA20553B8E00BB682E /* RNNScreenTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = 50415CB820553B8E00BB682E /* RNNScreenTransition.h */; };
71 67
 		50415CBB20553B8E00BB682E /* RNNScreenTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 50415CB920553B8E00BB682E /* RNNScreenTransition.m */; };
72 68
 		50451D052042DAEB00695F00 /* RNNPushAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 50451D032042DAEB00695F00 /* RNNPushAnimation.h */; };
@@ -252,10 +248,6 @@
252 248
 		390AD476200F499D00A8250D /* RNNSwizzles.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNSwizzles.m; sourceTree = "<group>"; };
253 249
 		5016E8ED2020968F009D4F7C /* RNNCustomTitleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNCustomTitleView.h; sourceTree = "<group>"; };
254 250
 		5016E8EE2020968F009D4F7C /* RNNCustomTitleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNCustomTitleView.m; sourceTree = "<group>"; };
255
-		5032774C2015E86D00ECD75D /* RNNNavigationEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNNavigationEvent.h; sourceTree = "<group>"; };
256
-		5032774D2015E86D00ECD75D /* RNNNavigationEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNNavigationEvent.m; sourceTree = "<group>"; };
257
-		5032775E2016302900ECD75D /* RNNComponentLifecycleEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNComponentLifecycleEvent.h; sourceTree = "<group>"; };
258
-		5032775F2016302900ECD75D /* RNNComponentLifecycleEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNComponentLifecycleEvent.m; sourceTree = "<group>"; };
259 251
 		50415CB820553B8E00BB682E /* RNNScreenTransition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNScreenTransition.h; sourceTree = "<group>"; };
260 252
 		50415CB920553B8E00BB682E /* RNNScreenTransition.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNScreenTransition.m; sourceTree = "<group>"; };
261 253
 		50451D032042DAEB00695F00 /* RNNPushAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNPushAnimation.h; sourceTree = "<group>"; };
@@ -538,10 +530,6 @@
538 530
 				E8AEDB461F58414D000F5A6A /* Animations */,
539 531
 				504AFE611FFE52EF0076E904 /* Options */,
540 532
 				50D031312005146C00386B3D /* Managers */,
541
-				5032774C2015E86D00ECD75D /* RNNNavigationEvent.h */,
542
-				5032774D2015E86D00ECD75D /* RNNNavigationEvent.m */,
543
-				5032775E2016302900ECD75D /* RNNComponentLifecycleEvent.h */,
544
-				5032775F2016302900ECD75D /* RNNComponentLifecycleEvent.m */,
545 533
 				26916C941E4B9CCC00D13680 /* RNNRootViewCreator.h */,
546 534
 				26916C961E4B9E7700D13680 /* RNNReactRootViewCreator.h */,
547 535
 				26916C971E4B9E7700D13680 /* RNNReactRootViewCreator.m */,
@@ -725,7 +713,6 @@
725 713
 				507F43F41FF4FCFE00D9425B /* HMSegmentedControl.h in Headers */,
726 714
 				50A00C37200F84D6000F01A6 /* RNNOverlayOptions.h in Headers */,
727 715
 				7B4928081E70415400555040 /* RNNCommandsHandler.h in Headers */,
728
-				5032774E2015E86D00ECD75D /* RNNNavigationEvent.h in Headers */,
729 716
 				263905AE1E4C6F440023D7D3 /* MMDrawerBarButtonItem.h in Headers */,
730 717
 				50F5DFC11F407A8C001A00BC /* RNNTabBarController.h in Headers */,
731 718
 				50CB3B691FDE911400AA153B /* RNNSideMenuOptions.h in Headers */,
@@ -743,7 +730,6 @@
743 730
 				263905C01E4C6F440023D7D3 /* SidebarAirbnbAnimation.h in Headers */,
744 731
 				E8367B801F7A8A4700675C05 /* VICMAImageView.h in Headers */,
745 732
 				263905E61E4CAC950023D7D3 /* RNNSideMenuChildVC.h in Headers */,
746
-				503277602016302900ECD75D /* RNNComponentLifecycleEvent.h in Headers */,
747 733
 				263905C41E4C6F440023D7D3 /* SidebarFacebookAnimation.h in Headers */,
748 734
 				50F5DFC51F407AA0001A00BC /* RNNNavigationController.h in Headers */,
749 735
 				21B85E5F1F44482A00B314B5 /* RNNNavigationButtons.h in Headers */,
@@ -928,8 +914,6 @@
928 914
 				263905C11E4C6F440023D7D3 /* SidebarAirbnbAnimation.m in Sources */,
929 915
 				263905D71E4C94970023D7D3 /* RNNSideMenuController.m in Sources */,
930 916
 				507F43CA1FF4F9CC00D9425B /* RNNTopTabOptions.m in Sources */,
931
-				503277612016302900ECD75D /* RNNComponentLifecycleEvent.m in Sources */,
932
-				5032774F2015E86D00ECD75D /* RNNNavigationEvent.m in Sources */,
933 917
 				26916C991E4B9E7700D13680 /* RNNReactRootViewCreator.m in Sources */,
934 918
 				214545251F4DC125006E8DA1 /* RNNUIBarButtonItem.m in Sources */,
935 919
 				263905B81E4C6F440023D7D3 /* UIViewController+MMDrawerController.m in Sources */,

+ 0
- 8
lib/src/adapters/NativeEventsReceiver.ts View File

@@ -19,14 +19,6 @@ export class NativeEventsReceiver {
19 19
     this.emitter.addListener('RNN.appLaunched', callback);
20 20
   }
21 21
 
22
-  registerNavigationCommands(callback) {
23
-    this.emitter.addListener('RNN.navigationCommands', callback);
24
-  }
25
-
26
-  registerComponentLifecycle(callback) {
27
-    this.emitter.addListener('RNN.componentLifecycle', callback);
28
-  }
29
-
30 22
   registerNavigationButtonPressed(callback) {
31 23
     this.emitter.addListener('RNN.navigationButtonPressed', callback);
32 24
   }