hybrid-navigation 2.12.2-rc.2 → 2.12.3
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.
- package/android/src/main/java/com/reactnative/hybridnavigation/HBDEventEmitter.java +1 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java +6 -6
- package/ios/HybridNavigation/Bridge/HBDReactBridgeManager.m +20 -59
- package/ios/HybridNavigation/GlobalStyle.m +5 -7
- package/ios/HybridNavigation/HBDUtils.h +5 -5
- package/package.json +1 -1
package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java
CHANGED
|
@@ -150,20 +150,20 @@ public class ScreenNavigator implements Navigator {
|
|
|
150
150
|
|
|
151
151
|
private void handleHideModal(@NonNull AwesomeFragment target, @NonNull Promise promise) {
|
|
152
152
|
AwesomeFragment presenting = target.getPresentingFragment();
|
|
153
|
-
if (presenting
|
|
154
|
-
|
|
153
|
+
if (presenting != null) {
|
|
154
|
+
presenting.dismissFragment(() -> promise.resolve(true), TransitionAnimation.Fade);
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
target.dismissFragment(() -> promise.resolve(true), TransitionAnimation.Fade);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
private void handleDismiss(@NonNull AwesomeFragment target, @NonNull Promise promise) {
|
|
161
161
|
AwesomeFragment presenting = target.getPresentingFragment();
|
|
162
|
-
if (presenting
|
|
163
|
-
|
|
162
|
+
if (presenting != null) {
|
|
163
|
+
presenting.dismissFragment(() -> promise.resolve(true));
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
target.dismissFragment(() -> promise.resolve(true));
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
private void handlePresent(@NonNull AwesomeFragment target, @NonNull ReadableMap extras, @NonNull Promise promise) {
|
|
@@ -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
|
-
|
|
289
|
-
|
|
288
|
+
NSDictionary *graph = [self buildRouteGraphWithViewController:vc];
|
|
290
289
|
NSMutableArray *root = [[NSMutableArray alloc] init];
|
|
291
|
-
|
|
292
|
-
|
|
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
|
-
- (
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
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
|
-
- (
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
@@ -38,7 +38,11 @@
|
|
|
38
38
|
|
|
39
39
|
@end
|
|
40
40
|
|
|
41
|
-
@implementation GlobalStyle
|
|
41
|
+
@implementation GlobalStyle {
|
|
42
|
+
UIColor *_barTintColor;
|
|
43
|
+
UIColor *_tintColor;
|
|
44
|
+
UIColor *_titleTextColor;
|
|
45
|
+
}
|
|
42
46
|
|
|
43
47
|
static GlobalStyle *globalStyle;
|
|
44
48
|
|
|
@@ -279,8 +283,6 @@ static GlobalStyle *globalStyle;
|
|
|
279
283
|
}
|
|
280
284
|
}
|
|
281
285
|
|
|
282
|
-
@synthesize barTintColor = _barTintColor;
|
|
283
|
-
|
|
284
286
|
- (void)setBarTintColor:(UIColor *)barTintColor {
|
|
285
287
|
_barTintColor = barTintColor;
|
|
286
288
|
_barTintColorDarkContent = barTintColor;
|
|
@@ -311,8 +313,6 @@ static GlobalStyle *globalStyle;
|
|
|
311
313
|
return UIColor.blackColor;
|
|
312
314
|
}
|
|
313
315
|
|
|
314
|
-
@synthesize tintColor = _tintColor;
|
|
315
|
-
|
|
316
316
|
- (void)setTintColor:(UIColor *)tintColor {
|
|
317
317
|
_tintColor = tintColor;
|
|
318
318
|
_tintColorDarkContent = tintColor;
|
|
@@ -343,8 +343,6 @@ static GlobalStyle *globalStyle;
|
|
|
343
343
|
return UIColor.whiteColor;
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
-
@synthesize titleTextColor = _titleTextColor;
|
|
347
|
-
|
|
348
346
|
- (void)setTitleTextColor:(UIColor *)titleTextColor {
|
|
349
347
|
_titleTextColor = titleTextColor;
|
|
350
348
|
_titleTextColorDarkContent = titleTextColor;
|
|
@@ -29,13 +29,13 @@ UIKIT_STATIC_INLINE BOOL imageHasAlphaChannel(UIImage *image) {
|
|
|
29
29
|
alpha == kCGImageAlphaPremultipliedLast);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
UIKIT_STATIC_INLINE void hbd_exchangeImplementations(Class
|
|
33
|
-
Method originalMethod = class_getInstanceMethod(
|
|
34
|
-
Method swizzledMethod = class_getInstanceMethod(
|
|
32
|
+
UIKIT_STATIC_INLINE void hbd_exchangeImplementations(Class klass, SEL originalSelector, SEL swizzledSelector) {
|
|
33
|
+
Method originalMethod = class_getInstanceMethod(klass, originalSelector);
|
|
34
|
+
Method swizzledMethod = class_getInstanceMethod(klass, swizzledSelector);
|
|
35
35
|
|
|
36
|
-
BOOL success = class_addMethod(
|
|
36
|
+
BOOL success = class_addMethod(klass, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod));
|
|
37
37
|
if (success) {
|
|
38
|
-
class_replaceMethod(
|
|
38
|
+
class_replaceMethod(klass, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
|
|
39
39
|
} else {
|
|
40
40
|
method_exchangeImplementations(originalMethod, swizzledMethod);
|
|
41
41
|
}
|
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.
|
|
4
|
+
"version": "2.12.3",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
7
7
|
"react-native": "src/index",
|