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.
- package/CHANGELOG.md +20 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/Garden.java +4 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +6 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/NavigationModule.java +35 -28
- package/ios/HybridNavigation/Bridge/HBDGardenModule.m +2 -1
- package/ios/HybridNavigation/GlobalStyle.h +4 -0
- package/ios/HybridNavigation/GlobalStyle.m +13 -0
- package/ios/HybridNavigation/HybridNavigation.h +1 -1
- package/ios/HybridNavigation/Navigator/HBDStackNavigator.m +12 -1
- package/ios/HybridNavigation/Navigator/HBDTabNavigator.m +2 -1
- package/ios/HybridNavigation/View/HBDNavigationBar.h +2 -3
- package/ios/HybridNavigation/View/HBDNavigationBar.m +31 -35
- package/ios/HybridNavigation/ViewController/HBDModalViewController.m +7 -0
- package/ios/HybridNavigation/ViewController/HBDNavigationController.m +18 -26
- package/ios/HybridNavigation/ViewController/HBDViewController+Garden.h +21 -0
- package/ios/HybridNavigation/{HBDGarden.m → ViewController/HBDViewController+Garden.m} +19 -45
- package/ios/HybridNavigation/ViewController/HBDViewController.h +1 -5
- package/ios/HybridNavigation/ViewController/HBDViewController.m +17 -14
- package/ios/HybridNavigation/ViewController/UINavigationController+HBD.m +5 -8
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.m +10 -7
- package/lib/typing.d.ts +1 -0
- package/package.json +1 -1
- package/docs/deeplink.html +0 -376
- package/docs/deeplink.pdf +0 -0
- 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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
36
|
-
|
|
17
|
+
- (void)setForceTransparentDialogWindow:(BOOL)transparent {
|
|
18
|
+
objc_setAssociatedObject(self, @selector(forceTransparentDialogWindow), @(transparent), OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
37
19
|
}
|
|
38
20
|
|
|
39
|
-
- (
|
|
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.
|
|
39
|
+
self.navigationItem.leftBarButtonItems = array;
|
|
65
40
|
} else {
|
|
66
|
-
self.
|
|
41
|
+
self.navigationItem.leftBarButtonItems = nil;
|
|
67
42
|
}
|
|
68
43
|
}
|
|
69
44
|
|
|
70
|
-
- (void)setRightBarButtonItem:(NSDictionary *
|
|
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.
|
|
63
|
+
self.navigationItem.rightBarButtonItems = array;
|
|
89
64
|
} else {
|
|
90
|
-
self.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
210
|
-
RCTRootView *rootView = (RCTRootView *) self.
|
|
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
|
|
14
|
+
#import "GlobalStyle.h"
|
|
12
15
|
|
|
13
16
|
@interface HBDViewController ()
|
|
14
17
|
|
|
15
18
|
@property(nonatomic, copy, readwrite) NSDictionary *props;
|
|
16
|
-
@property(nonatomic,
|
|
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
|
-
|
|
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 = [
|
|
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 ([
|
|
174
|
-
|
|
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
|
|
244
|
+
[self setRightBarButtonItem:RCTNilIfNull(rightBarButtonItem)];
|
|
242
245
|
}
|
|
243
246
|
|
|
244
247
|
id leftBarButtonItem = options[@"leftBarButtonItem"];
|
|
245
248
|
if (leftBarButtonItem) {
|
|
246
|
-
[self
|
|
249
|
+
[self setLeftBarButtonItem:RCTNilIfNull(leftBarButtonItem)];
|
|
247
250
|
}
|
|
248
251
|
|
|
249
252
|
NSArray *rightBarButtonItems = options[@"rightBarButtonItems"];
|
|
250
253
|
if (rightBarButtonItems) {
|
|
251
|
-
[self
|
|
254
|
+
[self setRightBarButtonItems:rightBarButtonItems];
|
|
252
255
|
}
|
|
253
256
|
|
|
254
257
|
NSArray *leftBarButtonItems = options[@"leftBarButtonItems"];
|
|
255
258
|
if (leftBarButtonItems) {
|
|
256
|
-
[self
|
|
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
|
|
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
|
|
20
|
-
|
|
21
|
-
|
|
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 = [[
|
|
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 = [[
|
|
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 = [[
|
|
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;
|