Browse Source

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

Masaru Ichikawa 6 years ago
parent
commit
f7267009de
1 changed files with 14 additions and 9 deletions
  1. 14
    9
      ios/RCCManagerModule.m

+ 14
- 9
ios/RCCManagerModule.m View File

171
                                    
171
                                    
172
                                    dispatch_semaphore_wait(dismiss_sema, DISPATCH_TIME_FOREVER);
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
                            }