hybrid-navigation 2.7.10 → 2.8.1

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 (26) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/reactnative/hybridnavigation/Garden.java +4 -0
  4. package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +6 -0
  5. package/android/src/main/java/com/reactnative/hybridnavigation/NavigationModule.java +35 -28
  6. package/ios/HybridNavigation/Bridge/HBDGardenModule.m +2 -1
  7. package/ios/HybridNavigation/GlobalStyle.h +4 -0
  8. package/ios/HybridNavigation/GlobalStyle.m +13 -0
  9. package/ios/HybridNavigation/HybridNavigation.h +1 -1
  10. package/ios/HybridNavigation/Navigator/HBDStackNavigator.m +12 -1
  11. package/ios/HybridNavigation/Navigator/HBDTabNavigator.m +2 -1
  12. package/ios/HybridNavigation/View/HBDNavigationBar.h +2 -3
  13. package/ios/HybridNavigation/View/HBDNavigationBar.m +31 -35
  14. package/ios/HybridNavigation/ViewController/HBDModalViewController.m +7 -0
  15. package/ios/HybridNavigation/ViewController/HBDNavigationController.m +18 -26
  16. package/ios/HybridNavigation/ViewController/HBDViewController+Garden.h +21 -0
  17. package/ios/HybridNavigation/{HBDGarden.m → ViewController/HBDViewController+Garden.m} +19 -45
  18. package/ios/HybridNavigation/ViewController/HBDViewController.h +1 -5
  19. package/ios/HybridNavigation/ViewController/HBDViewController.m +17 -14
  20. package/ios/HybridNavigation/ViewController/UINavigationController+HBD.m +5 -8
  21. package/ios/HybridNavigation/ViewController/UIViewController+HBD.m +10 -7
  22. package/lib/typing.d.ts +1 -0
  23. package/package.json +1 -1
  24. package/docs/deeplink.html +0 -376
  25. package/docs/deeplink.pdf +0 -0
  26. package/ios/HybridNavigation/HBDGarden.h +0 -36
@@ -1,49 +1,24 @@
1
- //
2
- // HBDGarden.m
3
- // HybridNavigation
4
- //
5
- // Created by Listen on 2017/11/26.
6
- // Copyright © 2018年 Listen. All rights reserved.
7
- //
8
-
9
- #import "HBDGarden.h"
10
1
  #import <React/RCTConvert.h>
11
2
  #import <React/RCTRootView.h>
12
3
 
4
+ #import "HBDViewController+Garden.h"
5
+
13
6
  #import "HBDBarButtonItem.h"
14
7
  #import "HBDUtils.h"
15
8
  #import "HBDEventEmitter.h"
16
9
 
10
+ @implementation HBDViewController (Garden)
17
11
 
18
- @interface HBDGarden ()
19
-
20
- @property(nonatomic, weak, readonly) HBDViewController *viewController;
21
-
22
- @end
23
-
24
- @implementation HBDGarden
25
-
26
- static GlobalStyle *globalStyle;
27
-
28
- + (void)createGlobalStyleWithOptions:(NSDictionary *)options {
29
- globalStyle = [[GlobalStyle alloc] initWithOptions:options];
30
- [globalStyle inflateNavigationBar:[UINavigationBar appearance]];
31
- [globalStyle inflateBarButtonItem:[UIBarButtonItem appearance]];
32
- [globalStyle inflateTabBar:[UITabBar appearance]];
12
+ - (BOOL)forceTransparentDialogWindow {
13
+ id obj = objc_getAssociatedObject(self, _cmd);
14
+ return obj ? [obj boolValue] : NO;
33
15
  }
34
16
 
35
- + (GlobalStyle *)globalStyle {
36
- return globalStyle;
17
+ - (void)setForceTransparentDialogWindow:(BOOL)transparent {
18
+ objc_setAssociatedObject(self, @selector(forceTransparentDialogWindow), @(transparent), OBJC_ASSOCIATION_COPY_NONATOMIC);
37
19
  }
38
20
 
39
- - (instancetype)initWithViewController:(HBDViewController *)vc {
40
- if (self = [super init]) {
41
- _viewController = vc;
42
- }
43
- return self;
44
- }
45
-
46
- - (void)setLeftBarButtonItem:(NSDictionary *__nullable)item {
21
+ - (void)setLeftBarButtonItem:(NSDictionary *)item {
47
22
  if (item) {
48
23
  NSMutableArray *array = [[NSMutableArray alloc] init];
49
24
  if (@available(iOS 11.0, *)) {
@@ -61,13 +36,13 @@ static GlobalStyle *globalStyle;
61
36
  }
62
37
  [array addObject:buttonItem];
63
38
 
64
- self.viewController.navigationItem.leftBarButtonItems = array;
39
+ self.navigationItem.leftBarButtonItems = array;
65
40
  } else {
66
- self.viewController.navigationItem.leftBarButtonItems = nil;
41
+ self.navigationItem.leftBarButtonItems = nil;
67
42
  }
68
43
  }
69
44
 
70
- - (void)setRightBarButtonItem:(NSDictionary *__nullable)item {
45
+ - (void)setRightBarButtonItem:(NSDictionary *)item {
71
46
  if (item) {
72
47
  NSMutableArray *array = [[NSMutableArray alloc] init];
73
48
  if (@available(iOS 11.0, *)) {
@@ -85,9 +60,9 @@ static GlobalStyle *globalStyle;
85
60
  }
86
61
  [array addObject:buttonItem];
87
62
 
88
- self.viewController.navigationItem.rightBarButtonItems = array;
63
+ self.navigationItem.rightBarButtonItems = array;
89
64
  } else {
90
- self.viewController.navigationItem.rightBarButtonItems = nil;
65
+ self.navigationItem.rightBarButtonItems = nil;
91
66
  }
92
67
  }
93
68
 
@@ -113,7 +88,7 @@ static GlobalStyle *globalStyle;
113
88
  }
114
89
  }
115
90
 
116
- self.viewController.navigationItem.leftBarButtonItems = array;
91
+ self.navigationItem.leftBarButtonItems = array;
117
92
  }
118
93
  }
119
94
 
@@ -138,7 +113,7 @@ static GlobalStyle *globalStyle;
138
113
  }
139
114
  }
140
115
 
141
- self.viewController.navigationItem.rightBarButtonItems = array;
116
+ self.navigationItem.rightBarButtonItems = array;
142
117
  }
143
118
  }
144
119
 
@@ -181,7 +156,7 @@ static GlobalStyle *globalStyle;
181
156
  }
182
157
 
183
158
  NSString *action = item[@"action"];
184
- NSString *sceneId = self.viewController.sceneId;
159
+ NSString *sceneId = self.sceneId;
185
160
 
186
161
  NSString *tintColor = item[@"tintColor"];
187
162
  if (tintColor) {
@@ -206,11 +181,10 @@ static GlobalStyle *globalStyle;
206
181
  }
207
182
 
208
183
  - (void)setPassThroughTouches:(BOOL)passThrough {
209
- if ([self.viewController.view isKindOfClass:[RCTRootView class]]) {
210
- RCTRootView *rootView = (RCTRootView *) self.viewController.view;
184
+ if ([self.view isKindOfClass:[RCTRootView class]]) {
185
+ RCTRootView *rootView = (RCTRootView *) self.view;
211
186
  rootView.passThroughTouches = passThrough;
212
187
  }
213
188
  }
214
189
 
215
190
  @end
216
-
@@ -8,16 +8,12 @@
8
8
 
9
9
  #import <UIKit/UIKit.h>
10
10
  #import "UIViewController+HBD.h"
11
- #import "HBDGarden.h"
12
-
13
- @class HBDGarden;
14
11
 
15
12
  @interface HBDViewController : UIViewController
16
13
 
17
14
  @property(nonatomic, copy, readonly) NSString *moduleName;
18
15
  @property(nonatomic, copy, readonly) NSDictionary *props;
19
- @property(nonatomic, copy) NSDictionary *options;
20
- @property(nonatomic, strong, readonly) HBDGarden *garden;
16
+ @property(nonatomic, copy, readonly) NSDictionary *options;
21
17
 
22
18
  - (instancetype)initWithModuleName:(NSString *)moduleName props:(NSDictionary *)props options:(NSDictionary *)options NS_DESIGNATED_INITIALIZER;
23
19
 
@@ -6,14 +6,17 @@
6
6
  // Copyright © 2018年 Listen. All rights reserved.
7
7
  //
8
8
 
9
+ #import <React/RCTLog.h>
10
+
9
11
  #import "HBDViewController.h"
12
+ #import "HBDViewController+Garden.h"
10
13
  #import "HBDUtils.h"
11
- #import <React/RCTLog.h>
14
+ #import "GlobalStyle.h"
12
15
 
13
16
  @interface HBDViewController ()
14
17
 
15
18
  @property(nonatomic, copy, readwrite) NSDictionary *props;
16
- @property(nonatomic, strong, readwrite) HBDGarden *garden;
19
+ @property(nonatomic, copy, readwrite) NSDictionary *options;
17
20
 
18
21
  @end
19
22
 
@@ -36,8 +39,8 @@
36
39
  _moduleName = moduleName;
37
40
  _options = options;
38
41
  _props = props;
39
- _garden = [[HBDGarden alloc] initWithViewController:self];
40
-
42
+
43
+ self.forceTransparentDialogWindow = [options[@"forceTransparentDialogWindow"] boolValue];
41
44
  [self applyNavigationBarOptions:options];
42
45
  [self applyTabBarOptions:options];
43
46
  }
@@ -100,7 +103,7 @@
100
103
  if (screenColor) {
101
104
  self.view.backgroundColor = [HBDUtils colorWithHexString:screenColor];
102
105
  } else {
103
- self.view.backgroundColor = [HBDGarden globalStyle].screenBackgroundColor;
106
+ self.view.backgroundColor = [GlobalStyle globalStyle].screenBackgroundColor;
104
107
  }
105
108
  }
106
109
 
@@ -170,15 +173,15 @@
170
173
  self.hbd_barHidden = YES;
171
174
  }
172
175
 
173
- if ([HBDGarden globalStyle].isBackTitleHidden) {
174
- self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:NULL];
176
+ if ([GlobalStyle globalStyle].isBackTitleHidden) {
177
+ UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] init];
178
+ self.navigationItem.backBarButtonItem = buttonItem;
175
179
  }
176
180
 
177
181
  NSDictionary *backItem = options[@"backItemIOS"];
178
182
  if (backItem) {
179
- NSString *title = backItem[@"title"];
180
183
  UIBarButtonItem *backButton = [[UIBarButtonItem alloc] init];
181
- backButton.title = title;
184
+ backButton.title = backItem[@"title"];
182
185
  NSString *tintColor = backItem[@"tintColor"];
183
186
  if (tintColor) {
184
187
  backButton.tintColor = [HBDUtils colorWithHexString:tintColor];
@@ -238,22 +241,22 @@
238
241
 
239
242
  id rightBarButtonItem = options[@"rightBarButtonItem"];
240
243
  if (rightBarButtonItem) {
241
- [self.garden setRightBarButtonItem:RCTNilIfNull(rightBarButtonItem)];
244
+ [self setRightBarButtonItem:RCTNilIfNull(rightBarButtonItem)];
242
245
  }
243
246
 
244
247
  id leftBarButtonItem = options[@"leftBarButtonItem"];
245
248
  if (leftBarButtonItem) {
246
- [self.garden setLeftBarButtonItem:RCTNilIfNull(leftBarButtonItem)];
249
+ [self setLeftBarButtonItem:RCTNilIfNull(leftBarButtonItem)];
247
250
  }
248
251
 
249
252
  NSArray *rightBarButtonItems = options[@"rightBarButtonItems"];
250
253
  if (rightBarButtonItems) {
251
- [self.garden setRightBarButtonItems:rightBarButtonItems];
254
+ [self setRightBarButtonItems:rightBarButtonItems];
252
255
  }
253
256
 
254
257
  NSArray *leftBarButtonItems = options[@"leftBarButtonItems"];
255
258
  if (leftBarButtonItems) {
256
- [self.garden setLeftBarButtonItems:leftBarButtonItems];
259
+ [self setLeftBarButtonItems:leftBarButtonItems];
257
260
  }
258
261
  }
259
262
 
@@ -303,7 +306,7 @@
303
306
 
304
307
  NSNumber *passThroughTouches = options[@"passThroughTouches"];
305
308
  if (passThroughTouches) {
306
- [self.garden setPassThroughTouches:[passThroughTouches boolValue]];
309
+ [self setPassThroughTouches:[passThroughTouches boolValue]];
307
310
  }
308
311
 
309
312
  if ([self shouldUpdateNavigationBar:options compareTo:previous]) {
@@ -16,15 +16,12 @@
16
16
 
17
17
  - (void)redirectToViewController:(UIViewController *)controller target:(UIViewController *)target animated:(BOOL)animated {
18
18
  NSMutableArray *children = [self.childViewControllers mutableCopy];
19
- NSUInteger count = self.childViewControllers.count;
20
- for (NSUInteger i = count; i > 0; i--) {
21
- NSUInteger index = i - 1;
22
- UIViewController *child = children[index];
23
- [children removeObjectAtIndex:index];
24
- if (child == target) {
25
- break;
26
- }
19
+ NSUInteger index = [children indexOfObject:target];
20
+ if (index == NSNotFound) {
21
+ return;
27
22
  }
23
+ NSUInteger count = self.childViewControllers.count;
24
+ [children removeObjectsInRange:NSMakeRange(index, count - index)];
28
25
  [children addObject:controller];
29
26
  if (children.count > 1) {
30
27
  controller.hidesBottomBarWhenPushed = self.hidesBottomBarWhenPushed;
@@ -6,14 +6,17 @@
6
6
  // Copyright © 2018年 Listen. All rights reserved.
7
7
  //
8
8
 
9
- #import "UIViewController+HBD.h"
10
9
  #import <objc/runtime.h>
11
- #import "HBDNavigationController.h"
12
- #import "HBDUtils.h"
13
- #import "HBDModalViewController.h"
14
10
  #import <React/RCTLog.h>
11
+
12
+ #import "UIViewController+HBD.h"
15
13
  #import "UITabBar+Badge.h"
16
14
 
15
+ #import "HBDNavigationController.h"
16
+ #import "HBDModalViewController.h"
17
+ #import "HBDUtils.h"
18
+ #import "GlobalStyle.h"
19
+
17
20
  @implementation UIViewController (HBD)
18
21
 
19
22
  + (void)load {
@@ -122,7 +125,7 @@
122
125
  color = obj;
123
126
  }
124
127
 
125
- UIColor *colorWithBarStyle = [[HBDGarden globalStyle] barTintColorWithBarStyle:self.hbd_barStyle];
128
+ UIColor *colorWithBarStyle = [[GlobalStyle globalStyle] barTintColorWithBarStyle:self.hbd_barStyle];
126
129
  if (color == nil && colorWithBarStyle != nil) {
127
130
  color = colorWithBarStyle;
128
131
  }
@@ -148,7 +151,7 @@
148
151
  return obj;
149
152
  }
150
153
 
151
- UIColor *colorWithBarStyle = [[HBDGarden globalStyle] tintColorWithBarStyle:self.hbd_barStyle];
154
+ UIColor *colorWithBarStyle = [[GlobalStyle globalStyle] tintColorWithBarStyle:self.hbd_barStyle];
152
155
  if (colorWithBarStyle) {
153
156
  return colorWithBarStyle;
154
157
  }
@@ -167,7 +170,7 @@
167
170
  }
168
171
 
169
172
  UIBarStyle barStyle = self.hbd_barStyle;
170
- UIColor *colorWithBarStyle = [[HBDGarden globalStyle] titleTextColorWithBarStyle:barStyle];
173
+ UIColor *colorWithBarStyle = [[GlobalStyle globalStyle] titleTextColorWithBarStyle:barStyle];
171
174
  NSDictionary *colorAttributes = @{NSForegroundColorAttributeName: colorWithBarStyle};
172
175
  NSDictionary *attributes = [UINavigationBar appearance].titleTextAttributes;
173
176
  if (attributes) {
package/lib/typing.d.ts CHANGED
@@ -58,6 +58,7 @@ export interface NavigationOption {
58
58
  }
59
59
  export interface NavigationItem extends NavigationOption {
60
60
  screenBackgroundColor?: Color;
61
+ forceTransparentDialogWindow?: boolean;
61
62
  topBarHidden?: boolean;
62
63
  extendedLayoutIncludesTopBar?: boolean;
63
64
  swipeBackEnabled?: boolean;
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.7.10",
4
+ "version": "2.8.1",
5
5
  "keywords": [
6
6
  "react-native",
7
7
  "navigation",