hybrid-navigation 2.7.3 → 2.7.6

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/android/build.gradle +1 -1
  3. package/ios/HybridNavigation/Bridge/HBDEventEmitter.h +16 -16
  4. package/ios/HybridNavigation/Bridge/HBDEventEmitter.m +33 -33
  5. package/ios/HybridNavigation/Bridge/HBDGardenModule.m +43 -25
  6. package/ios/HybridNavigation/Bridge/HBDNavigationModule.m +80 -54
  7. package/ios/HybridNavigation/Bridge/HBDReactBridgeManager.h +3 -3
  8. package/ios/HybridNavigation/Bridge/HBDReactBridgeManager.m +57 -61
  9. package/ios/HybridNavigation/GlobalStyle.h +7 -7
  10. package/ios/HybridNavigation/GlobalStyle.m +86 -86
  11. package/ios/HybridNavigation/HBDGarden.m +28 -28
  12. package/ios/HybridNavigation/HBDUtils.h +4 -4
  13. package/ios/HybridNavigation/HBDUtils.m +43 -49
  14. package/ios/HybridNavigation/Navigator/HBDDrawerNavigator.m +24 -24
  15. package/ios/HybridNavigation/Navigator/HBDNavigator.h +2 -2
  16. package/ios/HybridNavigation/Navigator/HBDNavigatorRegistry.h +4 -4
  17. package/ios/HybridNavigation/Navigator/HBDNavigatorRegistry.m +19 -20
  18. package/ios/HybridNavigation/Navigator/HBDScreenNavigator.m +24 -33
  19. package/ios/HybridNavigation/Navigator/HBDStackNavigator.m +29 -29
  20. package/ios/HybridNavigation/Navigator/HBDTabNavigator.m +54 -56
  21. package/ios/HybridNavigation/View/HBDBarButtonItem.h +1 -1
  22. package/ios/HybridNavigation/View/HBDBarButtonItem.m +5 -5
  23. package/ios/HybridNavigation/View/HBDNavigationBar.h +4 -4
  24. package/ios/HybridNavigation/View/HBDNavigationBar.m +19 -20
  25. package/ios/HybridNavigation/View/HBDReactTabBar.m +3 -3
  26. package/ios/HybridNavigation/View/HBDRootView.m +3 -3
  27. package/ios/HybridNavigation/View/HBDTitleView.m +7 -7
  28. package/ios/HybridNavigation/View/UITabBar+Badge.h +1 -0
  29. package/ios/HybridNavigation/View/UITabBar+Badge.m +6 -6
  30. package/ios/HybridNavigation/ViewController/HBDDrawerController.h +8 -5
  31. package/ios/HybridNavigation/ViewController/HBDDrawerController.m +39 -38
  32. package/ios/HybridNavigation/ViewController/HBDModalViewController.h +2 -2
  33. package/ios/HybridNavigation/ViewController/HBDModalViewController.m +49 -46
  34. package/ios/HybridNavigation/ViewController/HBDNavigationController.h +1 -1
  35. package/ios/HybridNavigation/ViewController/HBDNavigationController.m +115 -114
  36. package/ios/HybridNavigation/ViewController/HBDPopAnimation.m +4 -4
  37. package/ios/HybridNavigation/ViewController/HBDPushAnimation.m +4 -4
  38. package/ios/HybridNavigation/ViewController/HBDReactViewController.m +24 -26
  39. package/ios/HybridNavigation/ViewController/HBDTabBarController.h +1 -1
  40. package/ios/HybridNavigation/ViewController/HBDTabBarController.m +23 -25
  41. package/ios/HybridNavigation/ViewController/HBDViewController.m +31 -32
  42. package/ios/HybridNavigation/ViewController/UINavigationController+HBD.m +3 -3
  43. package/ios/HybridNavigation/ViewController/UIViewController+HBD.h +20 -19
  44. package/ios/HybridNavigation/ViewController/UIViewController+HBD.m +39 -40
  45. package/lib/DeepLink.js +5 -5
  46. package/lib/hooks.d.ts +1 -1
  47. package/lib/hooks.js +4 -7
  48. package/package.json +3 -3
@@ -8,33 +8,29 @@
8
8
 
9
9
  #import "HBDNavigationController.h"
10
10
  #import "HBDViewController.h"
11
- #import "UIViewController+HBD.h"
12
11
  #import "HBDNavigationBar.h"
13
- #import "HBDReactBridgeManager.h"
14
12
  #import "HBDUtils.h"
15
- #import "HBDReactViewController.h"
16
13
  #import "HBDPushAnimation.h"
17
14
  #import "HBDPopAnimation.h"
18
- #import "HBDGarden.h"
19
15
  #import <React/RCTLog.h>
20
16
 
21
- UIColor* blendColor(UIColor *from, UIColor *to, float percent) {
17
+ UIColor *blendColor(UIColor *from, UIColor *to, CGFloat percent) {
22
18
  CGFloat fromRed = 0;
23
19
  CGFloat fromGreen = 0;
24
20
  CGFloat fromBlue = 0;
25
21
  CGFloat fromAlpha = 0;
26
22
  [from getRed:&fromRed green:&fromGreen blue:&fromBlue alpha:&fromAlpha];
27
-
23
+
28
24
  CGFloat toRed = 0;
29
25
  CGFloat toGreen = 0;
30
26
  CGFloat toBlue = 0;
31
27
  CGFloat toAlpha = 0;
32
28
  [to getRed:&toRed green:&toGreen blue:&toBlue alpha:&toAlpha];
33
-
34
- CGFloat newRed = fromRed + (toRed - fromRed) * fminf(1, percent * 4) ;
35
- CGFloat newGreen = fromGreen + (toGreen - fromGreen) * fminf(1, percent * 4);
36
- CGFloat newBlue = fromBlue + (toBlue - fromBlue) * fminf(1, percent * 4);
37
- CGFloat newAlpha = fromAlpha + (toAlpha - fromAlpha) * fminf(1, percent * 4);
29
+
30
+ CGFloat newRed = fromRed + (toRed - fromRed) * fminf(1, (float) (percent * 4));
31
+ CGFloat newGreen = fromGreen + (toGreen - fromGreen) * fminf(1, (float) (percent * 4));
32
+ CGFloat newBlue = fromBlue + (toBlue - fromBlue) * fminf(1, (float) (percent * 4));
33
+ CGFloat newAlpha = fromAlpha + (toAlpha - fromAlpha) * fminf(1, (float) (percent * 4));
38
34
  return [UIColor colorWithRed:newRed green:newGreen blue:newBlue alpha:newAlpha];
39
35
  }
40
36
 
@@ -43,18 +39,18 @@ void adjustLayout(UIViewController *vc) {
43
39
  return;
44
40
  }
45
41
  vc.hbd_extendedLayoutDidSet = YES;
46
-
42
+
47
43
  BOOL isTranslucent = vc.hbd_barHidden || vc.hbd_barAlpha < 1.0 || colorHasAlphaComponent(vc.hbd_barTintColor);
48
44
  if (isTranslucent || vc.extendedLayoutIncludesOpaqueBars) {
49
45
  vc.edgesForExtendedLayout |= UIRectEdgeTop;
50
46
  } else {
51
47
  vc.edgesForExtendedLayout &= ~UIRectEdgeTop;
52
48
  }
53
-
49
+
54
50
  if (vc.hbd_barHidden) {
55
51
  if (@available(iOS 11.0, *)) {
56
52
  UIEdgeInsets insets = vc.additionalSafeAreaInsets;
57
- float height = vc.navigationController.navigationBar.bounds.size.height;
53
+ CGFloat height = vc.navigationController.navigationBar.bounds.size.height;
58
54
  vc.additionalSafeAreaInsets = UIEdgeInsetsMake(-height + insets.top, insets.left, insets.bottom, insets.right);
59
55
  }
60
56
  }
@@ -72,9 +68,9 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
72
68
 
73
69
  @interface HBDNavigationControllerDelegate : UIScreenEdgePanGestureRecognizer <UINavigationControllerDelegate, UIGestureRecognizerDelegate>
74
70
 
75
- @property (nonatomic, weak) id<UINavigationControllerDelegate> proxiedDelegate;
76
- @property (nonatomic, weak, readonly) HBDNavigationController *nav;
77
- @property (nonatomic, strong) UIPercentDrivenInteractiveTransition *interactiveTransition;
71
+ @property(nonatomic, weak) id <UINavigationControllerDelegate> proxyDelegate;
72
+ @property(nonatomic, weak, readonly) HBDNavigationController *nav;
73
+ @property(nonatomic, strong) UIPercentDrivenInteractiveTransition *interactiveTransition;
78
74
 
79
75
  - (instancetype)initWithNavigationController:(HBDNavigationController *)navigationController;
80
76
 
@@ -82,17 +78,20 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
82
78
 
83
79
  @interface HBDNavigationController ()
84
80
 
85
- @property (nonatomic, readonly) HBDNavigationBar *navigationBar;
86
- @property (nonatomic, strong) UIVisualEffectView *fromFakeBar;
87
- @property (nonatomic, strong) UIVisualEffectView *toFakeBar;
88
- @property (nonatomic, strong) UIImageView *fromFakeShadow;
89
- @property (nonatomic, strong) UIImageView *toFakeShadow;
90
- @property (nonatomic, weak) UIViewController *poppingViewController;
91
- @property (nonatomic, strong) HBDNavigationControllerDelegate *navigationDelegate;
81
+ @property(nonatomic, readonly) HBDNavigationBar *navigationBar;
82
+ @property(nonatomic, strong) UIVisualEffectView *fromFakeBar;
83
+ @property(nonatomic, strong) UIVisualEffectView *toFakeBar;
84
+ @property(nonatomic, strong) UIImageView *fromFakeShadow;
85
+ @property(nonatomic, strong) UIImageView *toFakeShadow;
86
+ @property(nonatomic, weak) UIViewController *poppingViewController;
87
+ @property(nonatomic, strong) HBDNavigationControllerDelegate *navigationDelegate;
92
88
 
93
89
  - (void)updateNavigationBarStyleForViewController:(UIViewController *)vc;
94
- - (void)updateNavigationBarTinitColorForViewController:(UIViewController *)vc;
90
+
91
+ - (void)updateNavigationBarTintColorForViewController:(UIViewController *)vc;
92
+
95
93
  - (void)updateNavigationBarAlphaForViewController:(UIViewController *)vc;
94
+
96
95
  - (void)updateNavigationBarBackgroundForViewController:(UIViewController *)vc;
97
96
 
98
97
  - (void)showFakeBarFrom:(UIViewController *)from to:(UIViewController *)to;
@@ -134,19 +133,22 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
134
133
  return NO;
135
134
  }
136
135
 
137
- - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer API_AVAILABLE(ios(7.0)){
138
- return YES;
136
+ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer API_AVAILABLE(ios(7.0)) {
137
+ if (gestureRecognizer == self.nav.interactivePopGestureRecognizer) {
138
+ return YES;
139
+ }
140
+ return NO;
139
141
  }
140
142
 
141
143
  - (void)handleNavigationTransition:(UIScreenEdgePanGestureRecognizer *)pan {
142
144
  HBDNavigationController *nav = self.nav;
143
-
144
- id<UIViewControllerTransitionCoordinator> coordinator = nav.transitionCoordinator;
145
-
146
- if (![self.proxiedDelegate respondsToSelector:@selector(navigationController:interactionControllerForAnimationController:)]) {
145
+
146
+ id <UIViewControllerTransitionCoordinator> coordinator = nav.transitionCoordinator;
147
+
148
+ if (![self.proxyDelegate respondsToSelector:@selector(navigationController:interactionControllerForAnimationController:)]) {
147
149
  if (self.interactiveTransition || (!coordinator && [self shouldBetterTransitionWithViewController:nav.topViewController])) {
148
150
  CGFloat process = [pan translationInView:nav.view].x / nav.view.bounds.size.width;
149
- process = MIN(1.0,(MAX(0.0, process)));
151
+ process = MIN(1.0, (MAX(0.0, process)));
150
152
  if (pan.state == UIGestureRecognizerStateBegan) {
151
153
  self.interactiveTransition = [UIPercentDrivenInteractiveTransition new];
152
154
  //触发pop转场动画
@@ -155,22 +157,22 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
155
157
  UIPercentDrivenInteractiveTransition *transition = self.interactiveTransition;
156
158
  [transition updateInteractiveTransition:process];
157
159
  } else if (pan.state == UIGestureRecognizerStateEnded
158
- || pan.state == UIGestureRecognizerStateCancelled){
160
+ || pan.state == UIGestureRecognizerStateCancelled) {
159
161
  if (process > 0.33) {
160
- [ self.interactiveTransition finishInteractiveTransition];
162
+ [self.interactiveTransition finishInteractiveTransition];
161
163
  } else {
162
- [ self.interactiveTransition cancelInteractiveTransition];
164
+ [self.interactiveTransition cancelInteractiveTransition];
163
165
  }
164
166
  self.interactiveTransition = nil;
165
167
  }
166
168
  } else {
167
- id<HBDNavigationTransitionProtocol> target = (id<HBDNavigationTransitionProtocol>)[nav superInteractivePopGestureRecognizer].delegate;
169
+ id <HBDNavigationTransitionProtocol> target = (id <HBDNavigationTransitionProtocol>) [nav superInteractivePopGestureRecognizer].delegate;
168
170
  if ([target respondsToSelector:@selector(handleNavigationTransition:)]) {
169
171
  [target handleNavigationTransition:pan];
170
172
  }
171
173
  }
172
174
  }
173
-
175
+
174
176
  // ----
175
177
  if (coordinator) {
176
178
  if (@available(iOS 11.0, *)) {
@@ -186,15 +188,15 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
186
188
  }
187
189
 
188
190
  - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
189
-
191
+
190
192
  adjustLayout(viewController);
191
-
192
- if (self.proxiedDelegate && [self.proxiedDelegate respondsToSelector:@selector(navigationController:willShowViewController:animated:)]) {
193
- [self.proxiedDelegate navigationController:navigationController willShowViewController:viewController animated:animated];
193
+
194
+ if (self.proxyDelegate && [self.proxyDelegate respondsToSelector:@selector(navigationController:willShowViewController:animated:)]) {
195
+ [self.proxyDelegate navigationController:navigationController willShowViewController:viewController animated:animated];
194
196
  }
195
-
197
+
196
198
  HBDNavigationController *nav = self.nav;
197
- id<UIViewControllerTransitionCoordinator> coordinator = nav.transitionCoordinator;
199
+ id <UIViewControllerTransitionCoordinator> coordinator = nav.transitionCoordinator;
198
200
  if (coordinator) {
199
201
  [self showViewController:viewController withCoordinator:coordinator];
200
202
  } else {
@@ -210,17 +212,17 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
210
212
  }
211
213
 
212
214
  - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
213
- if (self.proxiedDelegate && [self.proxiedDelegate respondsToSelector:@selector(navigationController:didShowViewController:animated:)]) {
214
- [self.proxiedDelegate navigationController:navigationController didShowViewController:viewController animated:animated];
215
+ if (self.proxyDelegate && [self.proxyDelegate respondsToSelector:@selector(navigationController:didShowViewController:animated:)]) {
216
+ [self.proxyDelegate navigationController:navigationController didShowViewController:viewController animated:animated];
215
217
  }
216
-
218
+
217
219
  UIViewController *poppingVC = self.nav.poppingViewController;
218
220
  if (poppingVC) {
219
221
  if (poppingVC.didHideActionBlock) {
220
222
  poppingVC.didHideActionBlock();
221
223
  poppingVC.didHideActionBlock = nil;
222
224
  }
223
-
225
+
224
226
  if ([poppingVC isKindOfClass:[HBDViewController class]]) {
225
227
  [viewController didReceiveResultCode:poppingVC.resultCode resultData:poppingVC.resultData requestCode:0];
226
228
  }
@@ -230,9 +232,9 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
230
232
  viewController.didShowActionBlock = nil;
231
233
  }
232
234
  }
233
-
235
+
234
236
  self.nav.poppingViewController = nil;
235
-
237
+
236
238
  if (!animated) {
237
239
  [self.nav updateNavigationBarForViewController:viewController];
238
240
  [self.nav clearFake];
@@ -240,38 +242,38 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
240
242
  }
241
243
 
242
244
  - (UIInterfaceOrientationMask)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController {
243
- if (self.proxiedDelegate && [self.proxiedDelegate respondsToSelector:@selector(navigationControllerSupportedInterfaceOrientations:)]) {
244
- return [self.proxiedDelegate navigationControllerSupportedInterfaceOrientations:navigationController];
245
+ if (self.proxyDelegate && [self.proxyDelegate respondsToSelector:@selector(navigationControllerSupportedInterfaceOrientations:)]) {
246
+ return [self.proxyDelegate navigationControllerSupportedInterfaceOrientations:navigationController];
245
247
  }
246
248
  return UIInterfaceOrientationMaskPortrait;
247
249
  }
248
250
 
249
- - (UIInterfaceOrientation)navigationControllerPreferredInterfaceOrientationForPresentation:(UINavigationController *)navigationController {
250
- if (self.proxiedDelegate && [self.proxiedDelegate respondsToSelector:@selector(navigationControllerPreferredInterfaceOrientationForPresentation:)]) {
251
- return [self.proxiedDelegate navigationControllerPreferredInterfaceOrientationForPresentation:navigationController];
251
+ - (UIInterfaceOrientation)navigationControllerPreferredInterfaceOrientationForPresentation:(UINavigationController *)navigationController {
252
+ if (self.proxyDelegate && [self.proxyDelegate respondsToSelector:@selector(navigationControllerPreferredInterfaceOrientationForPresentation:)]) {
253
+ return [self.proxyDelegate navigationControllerPreferredInterfaceOrientationForPresentation:navigationController];
252
254
  }
253
255
  return UIInterfaceOrientationPortrait;
254
256
  }
255
257
 
256
258
  - (nullable id <UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController
257
- interactionControllerForAnimationController:(id <UIViewControllerAnimatedTransitioning>) animationController {
258
- if (self.proxiedDelegate && [self.proxiedDelegate respondsToSelector:@selector(navigationController:interactionControllerForAnimationController:)]) {
259
- return [self.proxiedDelegate navigationController:navigationController interactionControllerForAnimationController:animationController];
259
+ interactionControllerForAnimationController:(id <UIViewControllerAnimatedTransitioning>)animationController {
260
+ if (self.proxyDelegate && [self.proxyDelegate respondsToSelector:@selector(navigationController:interactionControllerForAnimationController:)]) {
261
+ return [self.proxyDelegate navigationController:navigationController interactionControllerForAnimationController:animationController];
260
262
  }
261
263
 
262
264
  if ([animationController isKindOfClass:[HBDPopAnimation class]]) {
263
- return self.interactiveTransition;
265
+ return self.interactiveTransition;
264
266
  }
265
267
 
266
268
  return nil;
267
269
  }
268
270
 
269
271
  - (nullable id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
270
- animationControllerForOperation:(UINavigationControllerOperation)operation
271
- fromViewController:(UIViewController *)fromVC
272
- toViewController:(UIViewController *)toVC {
273
- if (self.proxiedDelegate && [self.proxiedDelegate respondsToSelector:@selector(navigationController:animationControllerForOperation:fromViewController:toViewController:)]) {
274
- return [self.proxiedDelegate navigationController:navigationController animationControllerForOperation:operation fromViewController:fromVC toViewController:toVC];
272
+ animationControllerForOperation:(UINavigationControllerOperation)operation
273
+ fromViewController:(UIViewController *)fromVC
274
+ toViewController:(UIViewController *)toVC {
275
+ if (self.proxyDelegate && [self.proxyDelegate respondsToSelector:@selector(navigationController:animationControllerForOperation:fromViewController:toViewController:)]) {
276
+ return [self.proxyDelegate navigationController:navigationController animationControllerForOperation:operation fromViewController:fromVC toViewController:toVC];
275
277
  } else {
276
278
  if (operation == UINavigationControllerOperationPush) {
277
279
  if ([self shouldBetterTransitionWithViewController:toVC]) {
@@ -291,42 +293,42 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
291
293
  - (BOOL)shouldBetterTransitionWithViewController:(UIViewController *)vc {
292
294
  BOOL shouldBetter = NO;
293
295
  if ([vc isKindOfClass:[HBDViewController class]]) {
294
- HBDViewController *hbd = (HBDViewController *)vc;
296
+ HBDViewController *hbd = (HBDViewController *) vc;
295
297
  shouldBetter = [hbd.options[@"passThroughTouches"] boolValue];
296
298
  }
297
299
  return shouldBetter;
298
300
  }
299
301
 
300
- - (void)showViewController:(UIViewController * _Nonnull)viewController withCoordinator: (id<UIViewControllerTransitionCoordinator>)coordinator {
302
+ - (void)showViewController:(UIViewController *_Nonnull)viewController withCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator {
301
303
  UIViewController *from = [coordinator viewControllerForKey:UITransitionContextFromViewControllerKey];
302
304
  UIViewController *to = [coordinator viewControllerForKey:UITransitionContextToViewControllerKey];
303
-
305
+
304
306
  if (@available(iOS 12.0, *)) {
305
307
  // Fix a system bug https://github.com/listenzz/HBDNavigationBar/issues/35
306
308
  [self resetButtonLabelInNavBar:self.nav.navigationBar];
307
309
  }
308
-
310
+
309
311
  if (self.nav.poppingViewController) {
310
312
  // Inspired by QMUI
311
313
  UILabel *backButtonLabel = self.nav.navigationBar.backButtonLabel;
312
314
  if (backButtonLabel) {
313
315
  backButtonLabel.hbd_specifiedTextColor = backButtonLabel.textColor;
314
316
  }
315
-
316
- [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
317
-
318
- } completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
317
+
318
+ [coordinator animateAlongsideTransition:^(id <UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
319
+
320
+ } completion:^(id <UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
319
321
  backButtonLabel.hbd_specifiedTextColor = nil;
320
322
  }];
321
323
  }
322
-
324
+
323
325
  [self.nav updateNavigationBarStyleForViewController:viewController];
324
326
 
325
- [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
327
+ [coordinator animateAlongsideTransition:^(id <UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
326
328
  BOOL shouldFake = [self shouldShowFakeBarFrom:from to:to viewController:viewController];
327
329
  if (shouldFake) {
328
330
  // title attributes, button tint color, barStyle
329
- [self.nav updateNavigationBarTinitColorForViewController:viewController];
331
+ [self.nav updateNavigationBarTintColorForViewController:viewController];
330
332
  // background alpha, background color, shadow image alpha
331
333
  [self.nav showFakeBarFrom:from to:to];
332
334
  } else {
@@ -338,14 +340,13 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
338
340
  }
339
341
  }
340
342
  }
341
- } completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
343
+ } completion:^(id <UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
342
344
  self.nav.poppingViewController = nil;
343
-
344
345
  if (@available(iOS 13.0, *)) {
345
346
  self.nav.navigationBar.scrollEdgeAppearance.backgroundColor = UIColor.clearColor;
346
347
  self.nav.navigationBar.standardAppearance.backgroundColor = UIColor.clearColor;
347
348
  }
348
-
349
+
349
350
  if (context.isCancelled) {
350
351
  if (to == viewController) {
351
352
  [self.nav updateNavigationBarForViewController:from];
@@ -359,7 +360,7 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
359
360
  poppingVC.didHideActionBlock();
360
361
  poppingVC.didHideActionBlock = nil;
361
362
  }
362
-
363
+
363
364
  if ([poppingVC isKindOfClass:[HBDViewController class]]) {
364
365
  [viewController didReceiveResultCode:poppingVC.resultCode resultData:poppingVC.resultData requestCode:0];
365
366
  }
@@ -370,7 +371,7 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
370
371
  }
371
372
  }
372
373
  }
373
-
374
+
374
375
  if (to == viewController) {
375
376
  [self.nav clearFake];
376
377
  }
@@ -400,19 +401,19 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
400
401
  }
401
402
  }
402
403
 
403
- - (BOOL)shouldShowFakeBarFrom:(UIViewController *)from to:(UIViewController *)to viewController:(UIViewController * _Nonnull)viewController {
404
- if ([HBDGarden globalStyle].awaysSplitNavigationBarTransition && to == viewController) {
404
+ - (BOOL)shouldShowFakeBarFrom:(UIViewController *)from to:(UIViewController *)to viewController:(UIViewController *_Nonnull)viewController {
405
+ if ([HBDGarden globalStyle].alwaysSplitNavigationBarTransition && to == viewController) {
405
406
  return YES;
406
407
  }
407
-
408
+
408
409
  if (to != viewController) {
409
410
  return NO;
410
411
  }
411
-
412
+
412
413
  if (![from.hbd_barTintColor.description isEqual:to.hbd_barTintColor.description]) {
413
414
  return YES;
414
415
  }
415
-
416
+
416
417
  return from.hbd_barAlpha < 1.0 || to.hbd_barAlpha < 1.0;
417
418
  }
418
419
 
@@ -429,7 +430,7 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
429
430
  - (instancetype)initWithRootViewController:(UIViewController *)rootViewController {
430
431
  if (self = [super initWithNavigationBarClass:[HBDNavigationBar class] toolbarClass:nil]) {
431
432
  if ([rootViewController isKindOfClass:[HBDViewController class]]) {
432
- HBDViewController *root = (HBDViewController *)rootViewController;
433
+ HBDViewController *root = (HBDViewController *) rootViewController;
433
434
  self.tabBarItem = root.tabBarItem;
434
435
  root.tabBarItem = nil;
435
436
  NSDictionary *tabItem = root.options[@"tabItem"];
@@ -439,7 +440,7 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
439
440
  self.hidesBottomBarWhenPushed = YES;
440
441
  }
441
442
  }
442
- self.viewControllers = @[ rootViewController ];
443
+ self.viewControllers = @[rootViewController];
443
444
  }
444
445
  return self;
445
446
  }
@@ -469,7 +470,7 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
469
470
  self.definesPresentationContext = NO;
470
471
  [self.navigationBar setTranslucent:YES];
471
472
  [self.navigationBar setShadowImage:[UINavigationBar appearance].shadowImage];
472
-
473
+
473
474
  if (@available(iOS 13.0, *)) {
474
475
  UINavigationBarAppearance *scrollEdgeAppearance = [[UINavigationBarAppearance alloc] init];
475
476
  [scrollEdgeAppearance configureWithTransparentBackground];
@@ -479,23 +480,23 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
479
480
  self.navigationBar.scrollEdgeAppearance = scrollEdgeAppearance;
480
481
  self.navigationBar.standardAppearance = [scrollEdgeAppearance copy];
481
482
  }
482
-
483
+
483
484
  self.navigationDelegate = [[HBDNavigationControllerDelegate alloc] initWithNavigationController:self];
484
- self.navigationDelegate.proxiedDelegate = self.delegate;
485
+ self.navigationDelegate.proxyDelegate = self.delegate;
485
486
  self.delegate = self.navigationDelegate;
486
487
  }
487
488
 
488
- - (void)setDelegate:(id<UINavigationControllerDelegate>)delegate {
489
+ - (void)setDelegate:(id <UINavigationControllerDelegate>)delegate {
489
490
  if ([delegate isKindOfClass:[HBDNavigationControllerDelegate class]] || !self.navigationDelegate) {
490
491
  [super setDelegate:delegate];
491
492
  } else {
492
- self.navigationDelegate.proxiedDelegate = delegate;
493
+ self.navigationDelegate.proxyDelegate = delegate;
493
494
  }
494
495
  }
495
496
 
496
497
  - (void)viewWillLayoutSubviews {
497
498
  [super viewWillLayoutSubviews];
498
- id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
499
+ id <UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
499
500
  if (!coordinator) {
500
501
  [self updateNavigationBarForViewController:self.topViewController];
501
502
  }
@@ -506,19 +507,19 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
506
507
  if ([HBDUtils isIphoneX]) {
507
508
  return;
508
509
  }
509
-
510
+
510
511
  if (@available(iOS 13.0, *)) {
511
512
  UIEdgeInsets safeAreaInsets = self.view.safeAreaInsets;
512
513
  UIEdgeInsets additionalInsets = self.additionalSafeAreaInsets;
513
-
514
+
514
515
  // RCTLogInfo(@"[Navigator] safeAreaInsets:%@, additionalInsets:%@", NSStringFromUIEdgeInsets(safeAreaInsets), NSStringFromUIEdgeInsets(additionalInsets));
515
-
516
+
516
517
  BOOL statusBarHidden = [UIApplication sharedApplication].keyWindow.windowScene.statusBarManager.statusBarHidden;
517
-
518
+
518
519
  if (statusBarHidden && safeAreaInsets.top == 0) {
519
520
  self.additionalSafeAreaInsets = UIEdgeInsetsMake(20, additionalInsets.left, additionalInsets.bottom, additionalInsets.right);
520
521
  }
521
-
522
+
522
523
  if (!statusBarHidden && safeAreaInsets.top == 40) {
523
524
  self.additionalSafeAreaInsets = UIEdgeInsetsMake(-20, additionalInsets.left, additionalInsets.bottom, additionalInsets.right);
524
525
  }
@@ -541,11 +542,11 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
541
542
  self.topViewController.didHideActionBlock();
542
543
  self.topViewController.didHideActionBlock = nil;
543
544
  }
544
-
545
+
545
546
  if (self.childViewControllers.count > 1) {
546
547
  self.poppingViewController = self.topViewController;
547
548
  }
548
-
549
+
549
550
  UIViewController *vc = [super popViewControllerAnimated:animated];
550
551
  // vc != self.topViewController
551
552
  [self fixClickBackIssue];
@@ -557,11 +558,11 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
557
558
  self.topViewController.didHideActionBlock();
558
559
  self.topViewController.didHideActionBlock = nil;
559
560
  }
560
-
561
+
561
562
  if (self.childViewControllers.count > 1) {
562
563
  self.poppingViewController = self.topViewController;
563
564
  }
564
-
565
+
565
566
  NSArray *array = [super popToViewController:viewController animated:animated];
566
567
  [self fixClickBackIssue];
567
568
  return array;
@@ -573,11 +574,11 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
573
574
  self.topViewController.didHideActionBlock();
574
575
  self.topViewController.didHideActionBlock = nil;
575
576
  }
576
-
577
+
577
578
  if (self.childViewControllers.count > 1) {
578
579
  self.poppingViewController = self.topViewController;
579
580
  }
580
-
581
+
581
582
  NSArray *array = [super popToRootViewControllerAnimated:animated];
582
583
  [self fixClickBackIssue];
583
584
  return array;
@@ -587,10 +588,10 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
587
588
  if (@available(iOS 13.0, *)) {
588
589
  return;
589
590
  }
590
-
591
+
591
592
  if (@available(iOS 11.0, *)) {
592
593
  // fix:ios 11,12,当前后两个页面的 barStyle 不一样时,点击返回按钮返回,前一个页面的标题颜色响应迟缓或不响应
593
- id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
594
+ id <UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
594
595
  if (!(coordinator && coordinator.interactive)) {
595
596
  self.navigationBar.barStyle = self.topViewController.hbd_barStyle;
596
597
  self.navigationBar.titleTextAttributes = self.topViewController.hbd_titleTextAttributes;
@@ -603,7 +604,7 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
603
604
  // empty
604
605
  } else {
605
606
  // Workaround for >= iOS7.1. Thanks to @boliva - http://stackoverflow.com/posts/comments/34452906
606
- [navBar.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull subview, NSUInteger idx, BOOL * _Nonnull stop) {
607
+ [navBar.subviews enumerateObjectsUsingBlock:^(__kindof UIView *_Nonnull subview, NSUInteger idx, BOOL *_Nonnull stop) {
607
608
  if (subview.alpha < 1.0) {
608
609
  [UIView animateWithDuration:.25 animations:^{
609
610
  subview.alpha = 1.0;
@@ -617,14 +618,14 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
617
618
  [self updateNavigationBarStyleForViewController:vc];
618
619
  [self updateNavigationBarAlphaForViewController:vc];
619
620
  [self updateNavigationBarBackgroundForViewController:vc];
620
- [self updateNavigationBarTinitColorForViewController:vc];
621
+ [self updateNavigationBarTintColorForViewController:vc];
621
622
  }
622
623
 
623
624
  - (void)updateNavigationBarStyleForViewController:(UIViewController *)vc {
624
625
  self.navigationBar.barStyle = vc.hbd_barStyle;
625
626
  }
626
627
 
627
- - (void)updateNavigationBarTinitColorForViewController:(UIViewController *)vc {
628
+ - (void)updateNavigationBarTintColorForViewController:(UIViewController *)vc {
628
629
  self.navigationBar.tintColor = vc.hbd_tintColor;
629
630
  self.navigationBar.titleTextAttributes = vc.hbd_titleTextAttributes;
630
631
  if (@available(iOS 13.0, *)) {
@@ -636,7 +637,7 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
636
637
  - (void)updateNavigationBarAlphaForViewController:(UIViewController *)vc {
637
638
  self.navigationBar.fakeView.alpha = vc.hbd_barAlpha;
638
639
  self.navigationBar.shadowImageView.alpha = vc.hbd_barShadowAlpha;
639
-
640
+
640
641
  if (vc.hbd_barAlpha == 0) {
641
642
  self.navigationBar.hbd_backgroundView.layer.mask = [CALayer new];
642
643
  } else {
@@ -648,7 +649,7 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
648
649
  self.navigationBar.barTintColor = vc.hbd_barTintColor;
649
650
  }
650
651
 
651
- - (void)showFakeBarFrom:(UIViewController *)from to:(UIViewController * _Nonnull)to {
652
+ - (void)showFakeBarFrom:(UIViewController *)from to:(UIViewController *_Nonnull)to {
652
653
  [UIView setAnimationsEnabled:NO];
653
654
  self.navigationBar.fakeView.alpha = 0;
654
655
  self.navigationBar.shadowImageView.alpha = 0;
@@ -670,7 +671,7 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
670
671
  [from.view addSubview:self.fromFakeShadow];
671
672
  }
672
673
 
673
- - (void)showFakeBarTo:(UIViewController * _Nonnull)to {
674
+ - (void)showFakeBarTo:(UIViewController *_Nonnull)to {
674
675
  self.toFakeBar.subviews.lastObject.backgroundColor = to.hbd_barTintColor;
675
676
  self.toFakeBar.alpha = to.hbd_barAlpha;
676
677
  self.toFakeBar.frame = [self fakeBarFrameForViewController:to];
@@ -731,9 +732,9 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
731
732
 
732
733
  // fix issue for pushed to UIViewController whose root view is UIScrollView.
733
734
  if ([vc.view isKindOfClass:[UIScrollView class]]) {
734
- UIScrollView *scrollview = (UIScrollView *)vc.view;
735
- scrollview.clipsToBounds = NO;
736
- if (scrollview.contentOffset.y == 0) {
735
+ UIScrollView *scrollView = (UIScrollView *) vc.view;
736
+ scrollView.clipsToBounds = NO;
737
+ if (scrollView.contentOffset.y == 0) {
737
738
  frame.origin.y = -frame.size.height;
738
739
  }
739
740
  }
@@ -16,15 +16,15 @@
16
16
  - (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext {
17
17
  UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey];
18
18
  UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey];
19
-
19
+
20
20
  [[transitionContext containerView] insertSubview:toView belowSubview:fromView];
21
-
21
+
22
22
  toView.transform = CGAffineTransformTranslate(CGAffineTransformIdentity, -transitionContext.containerView.bounds.size.width, 0);
23
-
23
+
24
24
  [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
25
25
  toView.transform = CGAffineTransformIdentity;
26
26
  fromView.transform = CGAffineTransformTranslate(CGAffineTransformIdentity, transitionContext.containerView.bounds.size.width, 0);
27
- } completion:^(BOOL finished) {
27
+ } completion:^(BOOL finished) {
28
28
  toView.transform = CGAffineTransformIdentity;
29
29
  fromView.transform = CGAffineTransformIdentity;
30
30
  [transitionContext completeTransition:!transitionContext.transitionWasCancelled];
@@ -14,18 +14,18 @@
14
14
  }
15
15
 
16
16
  - (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext {
17
-
17
+
18
18
  UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey];
19
19
  [transitionContext.containerView addSubview:toView];
20
-
20
+
21
21
  toView.transform = CGAffineTransformTranslate(CGAffineTransformIdentity, transitionContext.containerView.bounds.size.width, 0);
22
22
 
23
23
  UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey];
24
-
24
+
25
25
  [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
26
26
  fromView.transform = CGAffineTransformTranslate(CGAffineTransformIdentity, -transitionContext.containerView.bounds.size.width, 0);
27
27
  toView.transform = CGAffineTransformIdentity;
28
- } completion:^(BOOL finished) {
28
+ } completion:^(BOOL finished) {
29
29
  fromView.transform = CGAffineTransformIdentity;
30
30
  toView.transform = CGAffineTransformIdentity;
31
31
  [transitionContext completeTransition:!transitionContext.transitionWasCancelled];