Daniel Zlotin 7 年前
父节点
当前提交
73927dc875

+ 3
- 0
ios/RNNCommandsHandler.m 查看文件

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

+ 1
- 1
ios/RNNReactRootViewCreator.m 查看文件

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

+ 18
- 5
ios/RNNRootViewController.m 查看文件

@@ -1,6 +1,5 @@
1 1
 
2 2
 #import "RNNRootViewController.h"
3
-#import <React/RCTRootView.h>
4 3
 
5 4
 @interface RNNRootViewController()
6 5
 @property NSString* containerId;
@@ -17,19 +16,33 @@
17 16
 	self.eventEmitter = eventEmitter;
18 17
 	
19 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 22
 	return self;
21 23
 }
22 24
 
23
--(void)viewDidAppear:(BOOL)animated
24
-{
25
+-(void)viewDidAppear:(BOOL)animated {
25 26
 	[super viewDidAppear:animated];
26 27
 	[self.eventEmitter sendContainerStart:self.containerId];
27 28
 }
28 29
 
29
--(void)viewDidDisappear:(BOOL)animated
30
-{
30
+-(void)viewDidDisappear:(BOOL)animated {
31 31
 	[super viewDidDisappear:animated];
32 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 48
 @end

+ 1
- 0
ios/ReactNativeNavigation.m 查看文件

@@ -113,4 +113,5 @@
113 113
 }
114 114
 
115 115
 
116
+
116 117
 @end

+ 0
- 4
playground/e2e/app.test.js 查看文件

@@ -169,10 +169,6 @@ describe('reload app', () => {
169 169
   it('show welcome screen after reload', () => {
170 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 174
 function elementByLabel(label) {

+ 7
- 2
playground/src/containers/ModalScreen.js 查看文件

@@ -67,9 +67,14 @@ class ModalScreen extends Component {
67 67
   onClickDismissFirstInStack() {
68 68
     Navigation.dismissModal(_.head(this.props.previousModalIds));
69 69
   }
70
-  
70
+
71 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 80
   getModalPosition() {