hybrid-navigation 2.12.2-rc.1 → 2.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,5 +33,5 @@ dependencies {
33
33
  implementation fileTree(dir: 'libs', include: ['*.jar'])
34
34
  implementation 'com.facebook.react:react-native:+'
35
35
  // api project(':navigation')
36
- api 'io.github.listenzz:AndroidNavigation:12.5.6'
36
+ api 'io.github.listenzz:AndroidNavigation:12.5.7'
37
37
  }
@@ -285,75 +285,36 @@ const NSInteger ResultCancel = 0;
285
285
  - (NSArray *)routeGraph {
286
286
  UIWindow *mainWindow = [self mainWindow];
287
287
  UIViewController *vc = mainWindow.rootViewController;
288
- NSMutableDictionary *graph = [[self buildRouteGraphWithViewController:vc] mutableCopy];
289
-
288
+ NSDictionary *graph = [self buildRouteGraphWithViewController:vc];
290
289
  NSMutableArray *root = [[NSMutableArray alloc] init];
291
- NSMutableArray *modal = [[NSMutableArray alloc] init];
292
- NSMutableArray *present = [[NSMutableArray alloc] init];
293
-
294
- [self extractModal:modal present:present withGraph:graph];
295
-
296
- if (graph) {
297
- [root addObject:graph];
298
- }
299
-
300
- if ([present count] > 0) {
301
- [root addObjectsFromArray:present];
302
- }
303
-
304
- if ([modal count] > 0) {
305
- [root addObjectsFromArray:modal];
306
- }
307
-
290
+ [root addObject:graph];
291
+ [root addObjectsFromArray:[self presentedGraphsWithRootViewController:vc]];
292
+
308
293
  return root;
309
294
  }
310
295
 
311
- - (void)extractModal:(NSMutableArray *)modal present:(NSMutableArray *)present withGraph:(NSMutableDictionary *)graph {
312
- NSMutableDictionary *m = graph[@"ref_modal"];
313
- NSMutableDictionary *p = graph[@"ref_present"];
314
- if (m) {
315
- [graph removeObjectForKey:@"ref_modal"];
316
- [modal addObject:m];
317
- [self extractModal:modal present:present withGraph:m];
318
- }
319
-
320
- if (p) {
321
- [graph removeObjectForKey:@"ref_present"];
322
- [present addObject:p];
323
- [self extractModal:modal present:present withGraph:p];
324
- }
325
-
326
- NSArray *children = graph[@"children"];
327
- if (children) {
328
- for (int i = 0; i < children.count; i++) {
329
- NSMutableDictionary *child = children[i];
330
- [self extractModal:modal present:present withGraph:child];
296
+ - (NSArray *)presentedGraphsWithRootViewController:(UIViewController *)vc {
297
+ NSMutableArray *graphs = [[NSMutableArray alloc] init];
298
+ UIViewController *presented = vc.presentedViewController;
299
+ while (presented && !presented.beingDismissed && ![presented isKindOfClass:[UIAlertController class]]) {
300
+ NSDictionary *graph = [self buildRouteGraphWithViewController:presented];
301
+ if (graph) {
302
+ [graphs addObject:graph];
331
303
  }
304
+ presented = presented.presentedViewController;
332
305
  }
306
+
307
+ return graphs;
333
308
  }
334
309
 
335
- - (NSMutableDictionary *)buildRouteGraphWithViewController:(UIViewController *)vc {
336
- NSMutableDictionary *m = nil;
337
- NSMutableDictionary *p = nil;
338
- UIViewController *presented = vc.presentedViewController;
339
- if (presented && presented.presentingViewController == vc && !presented.beingDismissed && ![presented isKindOfClass:[UIAlertController class]]) {
340
- p = [[self buildRouteGraphWithViewController:presented] mutableCopy];
341
- }
342
-
310
+ - (NSDictionary *)buildRouteGraphWithViewController:(UIViewController *)vc {
343
311
  NSString *layout = [self.navigatorRegistry layoutForViewController:vc];
344
- if (layout) {
345
- id <HBDNavigator> navigator = [self.navigatorRegistry navigatorForLayout:layout];
346
- NSMutableDictionary *graph = [[navigator buildRouteGraphWithViewController:vc] mutableCopy];
347
- if (m) {
348
- graph[@"ref_modal"] = m;
349
- }
350
- if (p) {
351
- graph[@"ref_present"] = p;
352
- }
353
- return graph;
312
+ if (!layout) {
313
+ return nil;
354
314
  }
355
-
356
- return nil;
315
+
316
+ id <HBDNavigator> navigator = [self.navigatorRegistry navigatorForLayout:layout];
317
+ return [navigator buildRouteGraphWithViewController:vc];
357
318
  }
358
319
 
359
320
  - (void)handleNavigationWithViewController:(UIViewController *)target action:(NSString *)action extras:(NSDictionary *)extras resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hybrid-navigation",
3
3
  "description": "React Native Navigation that supports seamless navigation between Native and React.",
4
- "version": "2.12.2-rc.1",
4
+ "version": "2.12.2",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
7
7
  "react-native": "src/index",