Просмотр исходного кода

fixed a bug modal viewController was not deallocated when to call dismissAllModals (#2843)

Masaru Ichikawa 6 лет назад
Родитель
Сommit
f7267009de
1 измененных файлов: 14 добавлений и 9 удалений
  1. 14
    9
      ios/RCCManagerModule.m

+ 14
- 9
ios/RCCManagerModule.m Просмотреть файл

@@ -171,15 +171,20 @@ RCT_EXPORT_MODULE(RCCManager);
171 171
                                    
172 172
                                    dispatch_semaphore_wait(dismiss_sema, DISPATCH_TIME_FOREVER);
173 173
                                }
174
-                               else if (counter == allPresentedViewControllers.count && allPresentedViewControllers.count > 0)
175
-                               {
176
-                                   [allPresentedViewControllers removeAllObjects];
177
-                                   
178
-                                   if (resolve != nil) {
179
-                                       dispatch_async(dispatch_get_main_queue(), ^
180
-                                                      {
181
-                                                          resolve(nil);
182
-                                                      });
174
+                               else {
175
+                                   if (rootViewController != viewController) {
176
+                                       [[RCCManager sharedIntance] unregisterController:viewController];
177
+                                   }
178
+                                   if (counter == allPresentedViewControllers.count && allPresentedViewControllers.count > 0)
179
+                                   {
180
+                                       [allPresentedViewControllers removeAllObjects];
181
+
182
+                                       if (resolve != nil) {
183
+                                           dispatch_async(dispatch_get_main_queue(), ^
184
+                                                          {
185
+                                                              resolve(nil);
186
+                                                          });
187
+                                       }
183 188
                                    }
184 189
                                }
185 190
                            }