Daniel Zlotin 7 years ago
parent
commit
73927dc875

+ 3
- 0
ios/RNNCommandsHandler.m View File

24
 
24
 
25
 -(void) setRoot:(NSDictionary*)layout {
25
 -(void) setRoot:(NSDictionary*)layout {
26
 	[self assertReady];
26
 	[self assertReady];
27
+
28
+	[_modalManager dismissAllModals];
29
+	
27
 	UIViewController *vc = [_controllerFactory createLayoutAndSaveToStore:layout];
30
 	UIViewController *vc = [_controllerFactory createLayoutAndSaveToStore:layout];
28
 	
31
 	
29
 	UIApplication.sharedApplication.delegate.window.rootViewController = vc;
32
 	UIApplication.sharedApplication.delegate.window.rootViewController = vc;

+ 1
- 1
ios/RNNReactRootViewCreator.m View File

8
 
8
 
9
 @implementation RNNReactRootView
9
 @implementation RNNReactRootView
10
 
10
 
11
--(void) dealloc {
11
+-(void)dealloc {
12
 	
12
 	
13
 }
13
 }
14
 
14
 

+ 18
- 5
ios/RNNRootViewController.m View File

1
 
1
 
2
 #import "RNNRootViewController.h"
2
 #import "RNNRootViewController.h"
3
-#import <React/RCTRootView.h>
4
 
3
 
5
 @interface RNNRootViewController()
4
 @interface RNNRootViewController()
6
 @property NSString* containerId;
5
 @property NSString* containerId;
17
 	self.eventEmitter = eventEmitter;
16
 	self.eventEmitter = eventEmitter;
18
 	
17
 	
19
 	self.view = [creator createRootView:self.containerName rootViewId:self.containerId];
18
 	self.view = [creator createRootView:self.containerName rootViewId:self.containerId];
19
+	
20
+//	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onJsReload) name:RCTJavaScriptWillStartLoadingNotification object:nil];
21
+	
20
 	return self;
22
 	return self;
21
 }
23
 }
22
 
24
 
23
--(void)viewDidAppear:(BOOL)animated
24
-{
25
+-(void)viewDidAppear:(BOOL)animated {
25
 	[super viewDidAppear:animated];
26
 	[super viewDidAppear:animated];
26
 	[self.eventEmitter sendContainerStart:self.containerId];
27
 	[self.eventEmitter sendContainerStart:self.containerId];
27
 }
28
 }
28
 
29
 
29
--(void)viewDidDisappear:(BOOL)animated
30
-{
30
+-(void)viewDidDisappear:(BOOL)animated {
31
 	[super viewDidDisappear:animated];
31
 	[super viewDidDisappear:animated];
32
 	[self.eventEmitter sendContainerStop:self.containerId];
32
 	[self.eventEmitter sendContainerStop:self.containerId];
33
 }
33
 }
34
 
34
 
35
+///**
36
+// * fix for 
37
+// */
38
+//-(void)onJsReload {
39
+//	[[NSNotificationCenter defaultCenter] removeObserver:self];
40
+//	[[NSNotificationCenter defaultCenter] removeObserver:self.view];
41
+//	self.view = nil;
42
+//}
43
+
44
+-(void)dealloc {
45
+	
46
+}
47
+
35
 @end
48
 @end

+ 1
- 0
ios/ReactNativeNavigation.m View File

113
 }
113
 }
114
 
114
 
115
 
115
 
116
+
116
 @end
117
 @end

+ 0
- 4
playground/e2e/app.test.js View File

169
   it('show welcome screen after reload', () => {
169
   it('show welcome screen after reload', () => {
170
     expect(elementByLabel('React Native Navigation!')).toBeVisible();
170
     expect(elementByLabel('React Native Navigation!')).toBeVisible();
171
   });
171
   });
172
-
173
-  it('show modal then reload will not cause a leak', () => {
174
-    elementByLabel('Show Modal').tap();
175
-  });
176
 });
172
 });
177
 
173
 
178
 function elementByLabel(label) {
174
 function elementByLabel(label) {

+ 7
- 2
playground/src/containers/ModalScreen.js View File

67
   onClickDismissFirstInStack() {
67
   onClickDismissFirstInStack() {
68
     Navigation.dismissModal(_.head(this.props.previousModalIds));
68
     Navigation.dismissModal(_.head(this.props.previousModalIds));
69
   }
69
   }
70
-  
70
+
71
   onClickDismissAllModals() {
71
   onClickDismissAllModals() {
72
-    Navigation.dismissAllModals();
72
+    // Navigation.dismissAllModals();
73
+    Navigation.setRoot({
74
+      container: {
75
+        name: 'navigation.playground.WelcomeScreen'
76
+      }
77
+    });
73
   }
78
   }
74
 
79
 
75
   getModalPosition() {
80
   getModalPosition() {