hybrid-navigation 2.10.0 → 2.11.0

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 (44) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +28 -16
  3. package/android/src/main/java/com/reactnative/hybridnavigation/NavigationModule.java +1 -1
  4. package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarFragment.java +1 -1
  5. package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarProvider.java +1 -1
  6. package/android/src/main/java/com/reactnative/hybridnavigation/navigator/DrawerNavigator.java +1 -1
  7. package/android/src/main/java/com/reactnative/hybridnavigation/navigator/Navigator.java +2 -1
  8. package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java +28 -14
  9. package/android/src/main/java/com/reactnative/hybridnavigation/navigator/StackNavigator.java +1 -1
  10. package/android/src/main/java/com/reactnative/hybridnavigation/navigator/TabNavigator.java +2 -2
  11. package/ios/HybridNavigation/Bridge/HBDReactBridgeManager.m +3 -54
  12. package/ios/HybridNavigation/HybridNavigation.h +0 -1
  13. package/ios/HybridNavigation/Navigator/HBDScreenNavigator.m +19 -12
  14. package/ios/HybridNavigation/ViewController/HBDViewController+Garden.h +0 -2
  15. package/ios/HybridNavigation/ViewController/HBDViewController+Garden.m +0 -9
  16. package/ios/HybridNavigation/ViewController/HBDViewController.m +30 -0
  17. package/ios/HybridNavigation/ViewController/UIViewController+HBD.m +1 -16
  18. package/lib/Navigator.js +0 -1
  19. package/lib/ReactRegistry.d.ts +2 -4
  20. package/package.json +1 -1
  21. package/src/Navigator.ts +0 -1
  22. package/src/ReactRegistry.tsx +5 -7
  23. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  24. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  25. package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
  26. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  27. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  28. package/android/.gradle/7.4/gc.properties +0 -0
  29. package/android/.gradle/checksums/checksums.lock +0 -0
  30. package/android/.gradle/configuration-cache/gc.properties +0 -0
  31. package/android/.gradle/vcs-1/gc.properties +0 -0
  32. package/android/.idea/.name +0 -1
  33. package/android/.idea/gradle.xml +0 -16
  34. package/android/.idea/misc.xml +0 -9
  35. package/android/.idea/modules/android.iml +0 -18
  36. package/android/.idea/modules.xml +0 -8
  37. package/android/.idea/vcs.xml +0 -6
  38. package/android/local.properties +0 -8
  39. package/ios/HybridNavigation/ViewController/HBDModalViewController.h +0 -121
  40. package/ios/HybridNavigation/ViewController/HBDModalViewController.m +0 -514
  41. package/ios/HybridNavigation.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  42. package/ios/HybridNavigation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  43. package/ios/HybridNavigation.xcodeproj/project.xcworkspace/xcuserdata/listen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  44. package/ios/HybridNavigation.xcodeproj/xcuserdata/listen.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
@@ -1,514 +0,0 @@
1
- //
2
- // HBDModalViewController.m
3
- // HybridNavigation
4
- // fork from https://github.com/Tencent/QMUI_iOS/blob/master/QMUIKit/QMUIComponents/QMUIModalPresentationViewController.m
5
- // Created by Listen on 2018/6/4.
6
- // Copyright © 2018年 Listen. All rights reserved.
7
- //
8
-
9
- #import <React/RCTLog.h>
10
- #import <objc/runtime.h>
11
- #import "HBDModalViewController.h"
12
- #import "HBDRootView.h"
13
- #import "HBDUtils.h"
14
- #import "HBDViewController+Garden.h"
15
-
16
- @interface UIViewController ()
17
-
18
- @property(nonatomic, weak, readwrite) HBDModalViewController *hbd_modalViewController;
19
- @property(nonatomic, strong, readwrite) UIViewController *hbd_targetViewController;
20
- @property(nonatomic, weak, readwrite) UIViewController *hbd_popupViewController;
21
-
22
- @end
23
-
24
- @interface HBDModalViewController ()
25
-
26
- @property(nonatomic, assign, readwrite, getter=isBeingHidden) BOOL beingHidden;
27
-
28
- @property(nonatomic, strong, readwrite) UIView *contentView;
29
-
30
- @property(nonatomic, strong) HBDModalWindow *modalWindow;
31
- @property(nonatomic, weak, readwrite) UIWindow *previousKeyWindow;
32
- @property(nonatomic, strong) UITapGestureRecognizer *dimmingViewTapGestureRecognizer;
33
-
34
- @end
35
-
36
- @implementation HBDModalViewController
37
-
38
- - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
39
- if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
40
- [self didInitialized];
41
- }
42
- return self;
43
- }
44
-
45
- - (instancetype)initWithCoder:(NSCoder *)aDecoder {
46
- if (self = [super initWithCoder:aDecoder]) {
47
- [self didInitialized];
48
- }
49
- return self;
50
- }
51
-
52
- - (void)didInitialized {
53
- self.animationStyle = HBDModalAnimationStyleFade;
54
- self.contentViewMargins = UIEdgeInsetsZero;
55
- self.maximumContentViewWidth = [UIScreen mainScreen].bounds.size.width;
56
- [self initDefaultDimmingViewWithoutAddToView];
57
- }
58
-
59
- - (void)dealloc {
60
- self.modalWindow = nil;
61
- RCTLogInfo(@"[Navigator] %s", __FUNCTION__);
62
- }
63
-
64
- - (UIViewController *)childViewControllerForStatusBarStyle {
65
- return self.contentViewController;
66
- }
67
-
68
- - (UIViewController *)childViewControllerForStatusBarHidden {
69
- return self.contentViewController;
70
- }
71
-
72
- - (UIViewController *)childViewControllerForHomeIndicatorAutoHidden {
73
- return self.contentViewController;
74
- }
75
-
76
- - (void)viewDidLoad {
77
- [super viewDidLoad];
78
- self.view.backgroundColor = UIColor.clearColor;
79
- if (self.dimmingView && !self.dimmingView.superview) {
80
- [self.view addSubview:self.dimmingView];
81
- }
82
- }
83
-
84
- - (void)viewWillLayoutSubviews {
85
- [super viewWillLayoutSubviews];
86
- self.dimmingView.frame = self.view.bounds;
87
- if ([HBDUtils isInCall]) {
88
- self.dimmingView.frame = CGRectMake(CGRectGetMinX(self.view.bounds), CGRectGetMinY(self.view.bounds) + 20, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds) - 20);
89
- }
90
- CGRect contentViewFrame = [self contentViewFrameForShowing];
91
- if (self.layoutBlock) {
92
- self.layoutBlock(self, contentViewFrame);
93
- } else {
94
- self.contentView.frame = contentViewFrame;
95
- }
96
- }
97
-
98
- - (CGRect)contentViewFrameForShowing {
99
- if ([self.contentView isKindOfClass:[HBDRootView class]]) {
100
- return self.view.bounds;
101
- }
102
- CGSize contentViewContainerSize = CGSizeMake(CGRectGetWidth(self.view.bounds) - self.contentViewMargins.left - self.contentViewMargins.right, CGRectGetHeight(self.view.bounds) - self.contentViewMargins.top - self.contentViewMargins.bottom);
103
- CGSize contentViewLimitSize = CGSizeMake(fmin(self.maximumContentViewWidth, contentViewContainerSize.width), contentViewContainerSize.height);
104
- CGSize contentViewSize = CGSizeZero;
105
- if (self.measureBlock) {
106
- contentViewSize = self.measureBlock(self, contentViewLimitSize);
107
- } else {
108
- contentViewSize = [self.contentView sizeThatFits:contentViewLimitSize];
109
- }
110
- contentViewSize.width = fmin(contentViewLimitSize.width, contentViewSize.width);
111
- contentViewSize.height = fmin(contentViewLimitSize.height, contentViewSize.height);
112
- CGRect contentViewFrame = CGRectMake((contentViewContainerSize.width - contentViewSize.width) / 2 + self.contentViewMargins.left, (contentViewContainerSize.height - contentViewSize.height) / 2 + self.contentViewMargins.top, contentViewSize.width, contentViewSize.height);
113
- contentViewFrame = CGRectApplyAffineTransform(contentViewFrame, self.contentView.transform);
114
- return contentViewFrame;
115
- }
116
-
117
- - (void)viewDidAppear:(BOOL)animated {
118
- [super viewDidAppear:animated];
119
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameWillChange:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
120
- }
121
-
122
- - (void)viewDidDisappear:(BOOL)animated {
123
- [super viewDidDisappear:animated];
124
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
125
- }
126
-
127
- - (void)statusBarFrameWillChange:(NSNotification *)notification {
128
- [UIView animateWithDuration:0.35 animations:^{
129
- CGFloat dy = [HBDUtils isInCall] ? -20 : 20;
130
- self.dimmingView.frame = CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds) + dy);
131
- }];
132
- }
133
-
134
- - (void)updateLayout {
135
- if ([self isViewLoaded]) {
136
- [self.view setNeedsLayout];
137
- }
138
- }
139
-
140
- - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator {
141
- [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
142
- [coordinator animateAlongsideTransition:^(id <UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
143
- if (!UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation)) {
144
- self.view.frame = CGRectMake(0, 0, size.width, size.height);
145
- }
146
- [self updateLayout];
147
- } completion:^(id <UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
148
-
149
- }];
150
- }
151
-
152
- #pragma mark - Dimming View
153
-
154
- - (void)setDimmingView:(UIView *)dimmingView {
155
- if (![self isViewLoaded]) {
156
- _dimmingView = dimmingView;
157
- } else {
158
- [self.view insertSubview:dimmingView belowSubview:_dimmingView];
159
- [_dimmingView removeFromSuperview];
160
- _dimmingView = dimmingView;
161
- [self.view setNeedsLayout];
162
- }
163
- [self addTapGestureRecognizerToDimmingViewIfNeeded];
164
- }
165
-
166
- - (void)initDefaultDimmingViewWithoutAddToView {
167
- if (!self.dimmingView) {
168
- _dimmingView = [[UIView alloc] init];
169
- self.dimmingView.backgroundColor = [UIColor.blackColor colorWithAlphaComponent:0.6];
170
- [self addTapGestureRecognizerToDimmingViewIfNeeded];
171
- if ([self isViewLoaded]) {
172
- [self.view addSubview:self.dimmingView];
173
- }
174
- }
175
- }
176
-
177
- // 要考虑用户可能创建了自己的dimmingView,则tap手势也要重新添加上去
178
- - (void)addTapGestureRecognizerToDimmingViewIfNeeded {
179
- if (!self.dimmingView) {
180
- return;
181
- }
182
-
183
- if (self.dimmingViewTapGestureRecognizer.view == self.dimmingView) {
184
- return;
185
- }
186
-
187
- if (!self.dimmingViewTapGestureRecognizer) {
188
- self.dimmingViewTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDimmingViewTapGestureRecognizer:)];
189
- }
190
- [self.dimmingView addGestureRecognizer:self.dimmingViewTapGestureRecognizer];
191
- self.dimmingView.userInteractionEnabled = YES;// UIImageView默认userInteractionEnabled为NO,为了兼容UIImageView,这里必须主动设置为YES
192
- }
193
-
194
- - (void)handleDimmingViewTapGestureRecognizer:(UITapGestureRecognizer *)tapGestureRecognizer {
195
- [self.contentViewController hbd_hideViewControllerAnimated:YES completion:nil];
196
- }
197
-
198
- #pragma mark - ContentView
199
-
200
- - (void)setContentViewController:(UIViewController *)contentViewController {
201
- _contentViewController = contentViewController;
202
- if (contentViewController) {
203
- _contentViewController.hbd_modalViewController = self;
204
- [self addChildViewController:contentViewController];
205
- [contentViewController didMoveToParentViewController:self];
206
- }
207
- }
208
-
209
- - (void)setContentView:(UIView *)contentView {
210
- _contentView = contentView;
211
- if ([contentView isKindOfClass:[HBDRootView class]]) {
212
- HBDRootView *rootView = (HBDRootView *) contentView;
213
- rootView.backgroundColor = UIColor.clearColor;
214
- }
215
- }
216
-
217
- #pragma mark - Showing and Hiding
218
-
219
- - (void)showingAnimationWithCompletion:(void (^)(BOOL))completion {
220
- if (self.animationStyle == HBDModalAnimationStyleFade) {
221
- self.dimmingView.alpha = 0.0;
222
- self.contentView.alpha = 0.0;
223
- [UIView animateWithDuration:.2 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
224
- self.dimmingView.alpha = 1.0;
225
- self.contentView.alpha = 1.0;
226
- } completion:^(BOOL finished) {
227
- if (completion) {
228
- completion(finished);
229
- }
230
- }];
231
-
232
- } else if (self.animationStyle == HBDModalAnimationStylePopup) {
233
- self.dimmingView.alpha = 0.0;
234
- self.contentView.transform = CGAffineTransformMakeScale(0, 0);
235
- [UIView animateWithDuration:.3 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
236
- self.dimmingView.alpha = 1.0;
237
- self.contentView.transform = CGAffineTransformMakeScale(1, 1);
238
- } completion:^(BOOL finished) {
239
- self.contentView.transform = CGAffineTransformIdentity;
240
- if (completion) {
241
- completion(finished);
242
- }
243
- }];
244
-
245
- } else if (self.animationStyle == HBDModalAnimationStyleSlide) {
246
- self.dimmingView.alpha = 0.0;
247
- self.contentView.transform = CGAffineTransformMakeTranslation(0, CGRectGetHeight(self.view.bounds) - CGRectGetMinY(self.contentView.frame));
248
- [UIView animateWithDuration:.3 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
249
- self.dimmingView.alpha = 1.0;
250
- self.contentView.transform = CGAffineTransformIdentity;
251
- } completion:^(BOOL finished) {
252
- if (completion) {
253
- completion(finished);
254
- }
255
- }];
256
- }
257
- }
258
-
259
- - (void)hidingAnimationWithCompletion:(void (^)(BOOL))completion {
260
- if (self.animationStyle == HBDModalAnimationStyleFade) {
261
- [UIView animateWithDuration:.2 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
262
- self.dimmingView.alpha = 0.0;
263
- self.contentView.alpha = 0.0;
264
- } completion:^(BOOL finished) {
265
- if (completion) {
266
- completion(finished);
267
- }
268
- }];
269
- } else if (self.animationStyle == HBDModalAnimationStylePopup) {
270
- [UIView animateWithDuration:.3 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
271
- self.dimmingView.alpha = 0.0;
272
- self.contentView.transform = CGAffineTransformMakeScale(0.0, 0.0);
273
- } completion:^(BOOL finished) {
274
- if (completion) {
275
- self.contentView.transform = CGAffineTransformIdentity;
276
- completion(finished);
277
- }
278
- }];
279
- } else if (self.animationStyle == HBDModalAnimationStyleSlide) {
280
- [UIView animateWithDuration:.3 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
281
- self.dimmingView.alpha = 0.0;
282
- self.contentView.transform = CGAffineTransformMakeTranslation(0, CGRectGetHeight(self.view.bounds) - CGRectGetMinY(self.contentView.frame));
283
- } completion:^(BOOL finished) {
284
- if (completion) {
285
- self.contentView.transform = CGAffineTransformIdentity;
286
- completion(finished);
287
- }
288
- }];
289
- }
290
- }
291
-
292
- - (void)showWithAnimated:(BOOL)animated completion:(void (^)(BOOL))completion {
293
- self.contentView = self.contentViewController.view;
294
- self.previousKeyWindow = self.contentViewController.hbd_targetViewController.view.window;
295
-
296
- if (!self.modalWindow) {
297
- self.modalWindow = [[HBDModalWindow alloc] init];
298
- self.modalWindow.windowLevel = UIWindowLevelAlert - 4.0;;
299
- self.modalWindow.backgroundColor = UIColor.clearColor;// 避免横竖屏旋转时出现黑色
300
- }
301
-
302
- self.modalWindow.rootViewController = self;
303
- [self.modalWindow makeKeyAndVisible];
304
-
305
- void (^didShownCompletion)(BOOL finished) = ^(BOOL finished) {
306
- if (completion) {
307
- completion(finished);
308
- }
309
- };
310
-
311
- if (animated) {
312
- [self.view addSubview:self.contentView];
313
- [self.view layoutIfNeeded];
314
- CGRect contentViewFrame = [self contentViewFrameForShowing];
315
- if (self.showingAnimation) {
316
- // 使用自定义的动画
317
- if (self.layoutBlock) {
318
- self.layoutBlock(self, contentViewFrame);
319
- contentViewFrame = self.contentView.frame;
320
- }
321
- self.showingAnimation(self, contentViewFrame, didShownCompletion);
322
- } else {
323
- self.contentView.frame = contentViewFrame;
324
- [self.contentView setNeedsLayout];
325
- [self.contentView layoutIfNeeded];
326
- [self showingAnimationWithCompletion:didShownCompletion];
327
- }
328
- } else {
329
- CGRect contentViewFrame = [self contentViewFrameForShowing];
330
- self.contentView.frame = contentViewFrame;
331
- [self.view addSubview:self.contentView];
332
- self.dimmingView.alpha = 1;
333
- didShownCompletion(YES);
334
- }
335
- }
336
-
337
- - (void)hideWithAnimated:(BOOL)animated completion:(void (^)(BOOL))completion {
338
- self.beingHidden = YES;
339
- [self.view endEditing:YES];
340
-
341
- if (RCTKeyWindow() == self.modalWindow) {
342
- if (self.previousKeyWindow) {
343
- [self.previousKeyWindow makeKeyWindow];
344
- } else {
345
- [[UIApplication sharedApplication].delegate.window makeKeyWindow];
346
- }
347
- }
348
-
349
- if (self.contentViewController) {
350
- [self.contentViewController beginAppearanceTransition:NO animated:animated];
351
- }
352
-
353
- void (^didHiddenCompletion)(BOOL finished) = ^(BOOL finished) {
354
-
355
- if (self.contentViewController) {
356
- [self.contentViewController endAppearanceTransition];
357
- }
358
-
359
- self.modalWindow.hidden = YES;
360
- self.modalWindow.rootViewController = nil;
361
- self.previousKeyWindow = nil;
362
-
363
- if (self.willDismissBlock) {
364
- self.willDismissBlock(self);
365
- }
366
-
367
- if (completion) {
368
- completion(YES);
369
- }
370
-
371
- if (self.contentViewController) {
372
- self.contentViewController.hbd_targetViewController.hbd_popupViewController = nil;
373
- self.contentViewController.hbd_targetViewController = nil;
374
- self.contentViewController.hbd_modalViewController = nil;
375
- self.contentViewController = nil;
376
- }
377
- };
378
-
379
- if (animated) {
380
- if (self.hidingAnimation) {
381
- self.hidingAnimation(self, didHiddenCompletion);
382
- } else {
383
- [self hidingAnimationWithCompletion:didHiddenCompletion];
384
- }
385
- } else {
386
- didHiddenCompletion(YES);
387
- }
388
- }
389
-
390
- @end
391
-
392
- @interface HBDModalViewController (Manager)
393
- - (void)showWithAnimated:(BOOL)animated completion:(void (^)(BOOL finished))completion;
394
-
395
- - (void)hideWithAnimated:(BOOL)animated completion:(void (^)(BOOL finished))completion;
396
- @end
397
-
398
- @implementation HBDModalWindow
399
-
400
- @end
401
-
402
- @implementation UIViewController (HBDModalViewController)
403
-
404
- - (HBDModalViewController *)hbd_modalViewController {
405
- return objc_getAssociatedObject(self, _cmd);
406
- }
407
-
408
- - (void)setHbd_modalViewController:(HBDModalViewController *)modalViewController {
409
- objc_setAssociatedObject(self, @selector(hbd_modalViewController), modalViewController, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
410
- }
411
-
412
- - (UIViewController *)hbd_targetViewController {
413
- return objc_getAssociatedObject(self, _cmd);
414
- }
415
-
416
- - (void)setHbd_targetViewController:(UIViewController *)targetViewController {
417
- objc_setAssociatedObject(self, @selector(hbd_targetViewController), targetViewController, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
418
- }
419
-
420
- - (UIViewController *)hbd_popupViewController {
421
- return objc_getAssociatedObject(self, _cmd);
422
- }
423
-
424
- - (void)setHbd_popupViewController:(UIViewController *)puppetViewController {
425
- objc_setAssociatedObject(self, @selector(hbd_popupViewController), puppetViewController, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
426
- }
427
-
428
- - (void)hbd_showViewController:(UIViewController *)vc animated:(BOOL)animated completion:(void (^)(BOOL))completion {
429
- [self hbd_showViewController:vc requestCode:0 animated:animated completion:completion];
430
- }
431
-
432
- - (void)hbd_showViewController:(UIViewController *)vc requestCode:(NSInteger)requestCode animated:(BOOL)animated completion:(void (^)(BOOL))completion {
433
- if (![self canShowModal]) {
434
- [self didReceiveResultCode:0 resultData:nil requestCode:requestCode];
435
-
436
- if (completion) {
437
- completion(NO);
438
- }
439
- return;
440
- }
441
-
442
- self.hbd_popupViewController = vc;
443
- [self beginAppearanceTransition:NO animated:YES];
444
- [self endAppearanceTransition];
445
-
446
- vc.hbd_barStyle = self.hbd_barStyle;
447
- vc.hbd_targetViewController = self;
448
- vc.requestCode = requestCode;
449
-
450
- HBDModalViewController *modalViewController = [[HBDModalViewController alloc] init];
451
- modalViewController.contentViewController = vc;
452
- if ([vc isKindOfClass:[HBDViewController class]]) {
453
- HBDViewController *hbdvc = (HBDViewController *)vc;
454
- NSString *screenColor = hbdvc.options[@"screenBackgroundColor"];
455
- if (screenColor) {
456
- UIColor *color = [HBDUtils colorWithHexString:screenColor];
457
- if (colorHasAlphaComponent(color)) {
458
- modalViewController.dimmingView.backgroundColor = color;
459
- }
460
- }
461
- if (hbdvc.forceTransparentDialogWindow) {
462
- modalViewController.dimmingView.backgroundColor = UIColor.clearColor;
463
- }
464
- }
465
- [modalViewController showWithAnimated:animated completion:completion];
466
- }
467
-
468
- - (BOOL)canShowModal {
469
- UIViewController *presented = self.presentedViewController;
470
- if (presented && !presented.isBeingDismissed) {
471
- RCTLogWarn(@"[Navigator] Can't show modal since the scene had present another scene already.");
472
- return NO;
473
- }
474
-
475
- UIApplication *application = [[UIApplication class] performSelector:@selector(sharedApplication)];
476
- for (NSUInteger i = application.windows.count; i > 0; i--) {
477
- UIWindow *window = application.windows[i - 1];
478
- UIViewController *viewController = window.rootViewController;
479
- if ([viewController isKindOfClass:[HBDModalViewController class]]) {
480
- HBDModalViewController *modal = (HBDModalViewController *) viewController;
481
- if (!modal.beingHidden && window != self.view.window) {
482
- RCTLogWarn(@"[Navigator] Can't show modal since the scene had show another modal already.");
483
- return NO;
484
- }
485
- }
486
- }
487
-
488
- return YES;
489
- }
490
-
491
- - (void)hbd_hideViewControllerAnimated:(BOOL)animated completion:(void (^)(BOOL))completion {
492
- if (!self.hbd_modalViewController) {
493
- UIViewController *parent = self.parentViewController;
494
- parent.resultData = self.resultData;
495
- parent.resultCode = self.resultCode;
496
- [parent hbd_hideViewControllerAnimated:animated completion:completion];
497
- return;
498
- }
499
-
500
- [self.hbd_modalViewController hideWithAnimated:animated completion:^(BOOL finished) {
501
- UIViewController *target = self.hbd_targetViewController;
502
- [target beginAppearanceTransition:YES animated:YES];
503
- [target endAppearanceTransition];
504
- [target didReceiveResultCode:self.resultCode resultData:self.resultData requestCode:self.requestCode];
505
-
506
- if (completion) {
507
- completion(finished);
508
- }
509
- }];
510
- }
511
-
512
- @end
513
-
514
-
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- <FileRef
5
- location = "self:">
6
- </FileRef>
7
- </Workspace>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>IDEDidComputeMac32BitWarning</key>
6
- <true/>
7
- </dict>
8
- </plist>
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>SchemeUserState</key>
6
- <dict>
7
- <key>HybridNavigation.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>0</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </plist>