hybrid-navigation 2.7.5 → 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.
- package/CHANGELOG.md +6 -0
- package/android/build.gradle +1 -1
- package/ios/HybridNavigation/Bridge/HBDEventEmitter.h +16 -16
- package/ios/HybridNavigation/Bridge/HBDEventEmitter.m +33 -33
- package/ios/HybridNavigation/Bridge/HBDGardenModule.m +43 -25
- package/ios/HybridNavigation/Bridge/HBDNavigationModule.m +80 -54
- package/ios/HybridNavigation/Bridge/HBDReactBridgeManager.h +3 -3
- package/ios/HybridNavigation/Bridge/HBDReactBridgeManager.m +57 -61
- package/ios/HybridNavigation/GlobalStyle.h +7 -7
- package/ios/HybridNavigation/GlobalStyle.m +86 -86
- package/ios/HybridNavigation/HBDGarden.m +28 -28
- package/ios/HybridNavigation/HBDUtils.h +4 -4
- package/ios/HybridNavigation/HBDUtils.m +43 -49
- package/ios/HybridNavigation/Navigator/HBDDrawerNavigator.m +24 -24
- package/ios/HybridNavigation/Navigator/HBDNavigator.h +2 -2
- package/ios/HybridNavigation/Navigator/HBDNavigatorRegistry.h +4 -4
- package/ios/HybridNavigation/Navigator/HBDNavigatorRegistry.m +19 -20
- package/ios/HybridNavigation/Navigator/HBDScreenNavigator.m +24 -26
- package/ios/HybridNavigation/Navigator/HBDStackNavigator.m +29 -29
- package/ios/HybridNavigation/Navigator/HBDTabNavigator.m +54 -56
- package/ios/HybridNavigation/View/HBDBarButtonItem.h +1 -1
- package/ios/HybridNavigation/View/HBDBarButtonItem.m +5 -5
- package/ios/HybridNavigation/View/HBDNavigationBar.h +4 -4
- package/ios/HybridNavigation/View/HBDNavigationBar.m +19 -20
- package/ios/HybridNavigation/View/HBDReactTabBar.m +3 -3
- package/ios/HybridNavigation/View/HBDRootView.m +3 -3
- package/ios/HybridNavigation/View/HBDTitleView.m +7 -7
- package/ios/HybridNavigation/View/UITabBar+Badge.h +1 -0
- package/ios/HybridNavigation/View/UITabBar+Badge.m +6 -6
- package/ios/HybridNavigation/ViewController/HBDDrawerController.h +8 -5
- package/ios/HybridNavigation/ViewController/HBDDrawerController.m +39 -38
- package/ios/HybridNavigation/ViewController/HBDModalViewController.h +2 -2
- package/ios/HybridNavigation/ViewController/HBDModalViewController.m +45 -44
- package/ios/HybridNavigation/ViewController/HBDNavigationController.h +1 -1
- package/ios/HybridNavigation/ViewController/HBDNavigationController.m +111 -113
- package/ios/HybridNavigation/ViewController/HBDPopAnimation.m +4 -4
- package/ios/HybridNavigation/ViewController/HBDPushAnimation.m +4 -4
- package/ios/HybridNavigation/ViewController/HBDReactViewController.m +24 -26
- package/ios/HybridNavigation/ViewController/HBDTabBarController.h +1 -1
- package/ios/HybridNavigation/ViewController/HBDTabBarController.m +23 -25
- package/ios/HybridNavigation/ViewController/HBDViewController.m +31 -32
- package/ios/HybridNavigation/ViewController/UINavigationController+HBD.m +3 -3
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.h +20 -19
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.m +35 -36
- package/lib/DeepLink.js +5 -5
- package/lib/hooks.d.ts +1 -1
- package/lib/hooks.js +4 -7
- package/package.json +1 -1
|
@@ -12,29 +12,29 @@
|
|
|
12
12
|
|
|
13
13
|
@interface GlobalStyle ()
|
|
14
14
|
|
|
15
|
-
@property
|
|
16
|
-
|
|
17
|
-
@property
|
|
18
|
-
@property
|
|
19
|
-
@property
|
|
20
|
-
@property
|
|
21
|
-
@property
|
|
22
|
-
@property
|
|
23
|
-
@property
|
|
24
|
-
@property
|
|
25
|
-
@property
|
|
26
|
-
@property
|
|
27
|
-
@property
|
|
28
|
-
@property
|
|
29
|
-
@property
|
|
30
|
-
@property
|
|
31
|
-
|
|
32
|
-
@property
|
|
33
|
-
@property
|
|
34
|
-
@property
|
|
35
|
-
@property
|
|
36
|
-
|
|
37
|
-
@property
|
|
15
|
+
@property(nonatomic, copy, readonly) NSDictionary *options;
|
|
16
|
+
|
|
17
|
+
@property(nonatomic, assign) UIBarStyle barStyle;
|
|
18
|
+
@property(nonatomic, strong) UIImage *shadowImage;
|
|
19
|
+
@property(nonatomic, strong) UIImage *backIcon;
|
|
20
|
+
@property(nonatomic, strong) UIColor *barTintColor;
|
|
21
|
+
@property(nonatomic, strong) UIColor *barTintColorDarkContent;
|
|
22
|
+
@property(nonatomic, strong) UIColor *barTintColorLightContent;
|
|
23
|
+
@property(nonatomic, strong) UIColor *tintColor;
|
|
24
|
+
@property(nonatomic, strong) UIColor *tintColorDarkContent;
|
|
25
|
+
@property(nonatomic, strong) UIColor *tintColorLightContent;
|
|
26
|
+
@property(nonatomic, strong) UIColor *titleTextColor;
|
|
27
|
+
@property(nonatomic, strong) UIColor *titleTextColorDarkContent;
|
|
28
|
+
@property(nonatomic, strong) UIColor *titleTextColorLightContent;
|
|
29
|
+
@property(nonatomic, assign) NSInteger titleTextSize;
|
|
30
|
+
@property(nonatomic, assign) NSInteger barButtonItemTextSize;
|
|
31
|
+
|
|
32
|
+
@property(nonatomic, strong) UIColor *tabBarBackgroundColor;
|
|
33
|
+
@property(nonatomic, strong) UIImage *tabBarShadowImage;
|
|
34
|
+
@property(nonatomic, strong) UIColor *tabBarTintColor;
|
|
35
|
+
@property(nonatomic, strong) UIColor *tabBarUnselectedTintColor;
|
|
36
|
+
|
|
37
|
+
@property(nonatomic, assign, readwrite) BOOL alwaysSplitNavigationBarTransition;
|
|
38
38
|
|
|
39
39
|
@end
|
|
40
40
|
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
- (instancetype)initWithOptions:(NSDictionary *)options {
|
|
44
44
|
if (self = [super init]) {
|
|
45
45
|
_options = options;
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
// screenBackgroundColor
|
|
48
48
|
NSString *screenBackgroundColor = options[@"screenBackgroundColor"];
|
|
49
49
|
if (screenBackgroundColor) {
|
|
@@ -51,41 +51,41 @@
|
|
|
51
51
|
} else {
|
|
52
52
|
_screenBackgroundColor = UIColor.whiteColor;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
NSString *topBarStyle = self.options[@"topBarStyle"];
|
|
56
56
|
if (topBarStyle && [topBarStyle isEqualToString:@"light-content"]) {
|
|
57
57
|
self.barStyle = UIBarStyleBlack;
|
|
58
58
|
} else {
|
|
59
59
|
self.barStyle = UIBarStyleDefault;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
// topBarColor
|
|
63
63
|
NSString *topBarColor = self.options[@"topBarColor"];
|
|
64
64
|
if (topBarColor) {
|
|
65
65
|
self.barTintColor = [HBDUtils colorWithHexString:topBarColor];
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
NSNumber *splitTopBarTransitionIOS = self.options[@"splitTopBarTransitionIOS"];
|
|
69
69
|
if (splitTopBarTransitionIOS) {
|
|
70
|
-
self.
|
|
70
|
+
self.alwaysSplitNavigationBarTransition = [splitTopBarTransitionIOS boolValue];
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
NSString *topBarColorDarkContent = self.options[@"topBarColorDarkContent"];
|
|
74
74
|
if (topBarColorDarkContent) {
|
|
75
75
|
self.barTintColorDarkContent = [HBDUtils colorWithHexString:topBarColorDarkContent];
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
NSString *topBarColorLightContent = self.options[@"topBarColorLightContent"];
|
|
79
79
|
if (topBarColorLightContent) {
|
|
80
80
|
self.barTintColorLightContent = [HBDUtils colorWithHexString:topBarColorLightContent];
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
// navigationBar
|
|
84
|
-
NSDictionary *
|
|
85
|
-
if (RCTNilIfNull(
|
|
82
|
+
|
|
83
|
+
// navigationBar shadowImage
|
|
84
|
+
NSDictionary *shadowImage = self.options[@"shadowImage"];
|
|
85
|
+
if (RCTNilIfNull(shadowImage)) {
|
|
86
86
|
UIImage *image = [UIImage new];
|
|
87
|
-
NSDictionary *imageItem =
|
|
88
|
-
NSString *color =
|
|
87
|
+
NSDictionary *imageItem = shadowImage[@"image"];
|
|
88
|
+
NSString *color = shadowImage[@"color"];
|
|
89
89
|
if (imageItem) {
|
|
90
90
|
image = [HBDUtils UIImage:imageItem];
|
|
91
91
|
} else if (color) {
|
|
@@ -102,45 +102,45 @@
|
|
|
102
102
|
if (hideBackTitle) {
|
|
103
103
|
_backTitleHidden = [hideBackTitle boolValue];
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
// backIcon
|
|
107
107
|
NSDictionary *backIcon = self.options[@"backIcon"];
|
|
108
108
|
if (backIcon) {
|
|
109
109
|
self.backIcon = [HBDUtils UIImage:backIcon];
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
// topBarTintColor,
|
|
113
113
|
NSString *topBarTintColor = self.options[@"topBarTintColor"];
|
|
114
114
|
if (topBarTintColor) {
|
|
115
115
|
self.tintColor = [HBDUtils colorWithHexString:topBarTintColor];
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
NSString *topBarTintColorDarkContent = self.options[@"topBarTintColorDarkContent"];
|
|
119
119
|
if (topBarTintColorDarkContent) {
|
|
120
120
|
self.tintColorDarkContent = [HBDUtils colorWithHexString:topBarTintColorDarkContent];
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
NSString *topBarTintColorLightContent = self.options[@"topBarTintColorLightContent"];
|
|
124
124
|
if (topBarTintColorLightContent) {
|
|
125
125
|
self.tintColorLightContent = [HBDUtils colorWithHexString:topBarTintColorLightContent];
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
|
|
128
128
|
// titleTextColor,
|
|
129
|
-
|
|
129
|
+
NSString *titleTextColor = self.options[@"titleTextColor"];
|
|
130
130
|
if (titleTextColor) {
|
|
131
131
|
self.titleTextColor = [HBDUtils colorWithHexString:titleTextColor];
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
NSString *titleTextColorDarkContent = self.options[@"titleTextColorDarkContent"];
|
|
135
135
|
if (titleTextColorDarkContent) {
|
|
136
136
|
self.titleTextColorDarkContent = [HBDUtils colorWithHexString:titleTextColorDarkContent];
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
|
|
139
139
|
NSString *titleTextColorLightContent = self.options[@"titleTextColorLightContent"];
|
|
140
140
|
if (titleTextColorLightContent) {
|
|
141
141
|
self.titleTextColorLightContent = [HBDUtils colorWithHexString:titleTextColorLightContent];
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
// titleTextSize
|
|
145
145
|
NSNumber *titleTextSize = self.options[@"titleTextSize"];
|
|
146
146
|
if (titleTextSize) {
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
} else {
|
|
156
156
|
self.barButtonItemTextSize = 15;
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
|
|
159
159
|
// tabBarColor
|
|
160
160
|
NSString *tabBarColor = self.options[@"tabBarColor"];
|
|
161
161
|
if (tabBarColor) {
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
} else {
|
|
164
164
|
self.tabBarBackgroundColor = [HBDUtils colorWithHexString:@"#FFFFFF"];
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
//
|
|
166
|
+
|
|
167
|
+
// shadowImage
|
|
168
168
|
NSDictionary *tabBarShadowImage = self.options[@"tabBarShadowImage"];
|
|
169
169
|
if (RCTNilIfNull(tabBarShadowImage)) {
|
|
170
170
|
UIImage *image = [UIImage new];
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
}
|
|
178
178
|
self.tabBarShadowImage = image;
|
|
179
179
|
}
|
|
180
|
-
|
|
180
|
+
|
|
181
181
|
// tabBar tintColor
|
|
182
182
|
NSString *tabBarItemColor = self.options[@"tabBarItemColor"];
|
|
183
183
|
self.tabBarUnselectedItemColorHexString = @"#BDBDBD";
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
self.tabBarUnselectedItemColorHexString = tabBarUnselectedItemColor;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
|
|
195
195
|
NSString *badgeColor = self.options[@"tabBarBadgeColor"];
|
|
196
196
|
self.badgeColorHexString = @"#FF3B30";
|
|
197
197
|
if (badgeColor) {
|
|
@@ -203,37 +203,37 @@
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
- (void)inflateNavigationBar:(UINavigationBar *)navigationBar {
|
|
206
|
-
|
|
206
|
+
|
|
207
207
|
[navigationBar setBarStyle:self.barStyle];
|
|
208
208
|
if (self.barTintColor) {
|
|
209
209
|
[navigationBar setBarTintColor:self.barTintColor];
|
|
210
210
|
}
|
|
211
|
-
|
|
211
|
+
|
|
212
212
|
if (self.shadowImage) {
|
|
213
213
|
[navigationBar setShadowImage:self.shadowImage];
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
|
|
216
216
|
if (self.backIcon) {
|
|
217
217
|
[navigationBar setBackIndicatorImage:self.backIcon];
|
|
218
218
|
[navigationBar setBackIndicatorTransitionMaskImage:self.backIcon];
|
|
219
219
|
}
|
|
220
|
-
|
|
220
|
+
|
|
221
221
|
if (self.tintColor) {
|
|
222
222
|
[navigationBar setTintColor:self.tintColor];
|
|
223
223
|
}
|
|
224
|
-
|
|
224
|
+
|
|
225
225
|
// title
|
|
226
226
|
NSMutableDictionary *titleAttributes = [[NSMutableDictionary alloc] init];
|
|
227
227
|
if (self.titleTextColor) {
|
|
228
|
-
[
|
|
228
|
+
titleAttributes[NSForegroundColorAttributeName] = self.titleTextColor;
|
|
229
229
|
}
|
|
230
|
-
[
|
|
230
|
+
titleAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:self.titleTextSize];
|
|
231
231
|
[navigationBar setTitleTextAttributes:titleAttributes];
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
- (void)inflateBarButtonItem:(UIBarButtonItem *)barButtonItem {
|
|
235
235
|
NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init];
|
|
236
|
-
[
|
|
236
|
+
attributes[NSFontAttributeName] = [UIFont systemFontOfSize:self.barButtonItemTextSize];
|
|
237
237
|
[barButtonItem setTitleTextAttributes:attributes forState:UIControlStateNormal];
|
|
238
238
|
[barButtonItem setTitleTextAttributes:attributes forState:UIControlStateHighlighted];
|
|
239
239
|
[barButtonItem setTitleTextAttributes:attributes forState:UIControlStateDisabled];
|
|
@@ -248,15 +248,15 @@
|
|
|
248
248
|
tabBar.scrollEdgeAppearance = appearance;
|
|
249
249
|
tabBar.standardAppearance = appearance;
|
|
250
250
|
}
|
|
251
|
-
|
|
251
|
+
|
|
252
252
|
if (self.tabBarBackgroundColor) {
|
|
253
253
|
[tabBar setBackgroundImage:[HBDUtils imageWithColor:self.tabBarBackgroundColor]];
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
|
|
256
256
|
if (self.tabBarShadowImage) {
|
|
257
|
-
|
|
257
|
+
[tabBar setShadowImage:self.tabBarShadowImage];
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
|
|
260
260
|
if (self.tabBarTintColor) {
|
|
261
261
|
[tabBar setTintColor:self.tabBarTintColor];
|
|
262
262
|
}
|
|
@@ -282,19 +282,19 @@
|
|
|
282
282
|
if (barStyle == UIBarStyleDefault && _barTintColorDarkContent) {
|
|
283
283
|
return _barTintColorDarkContent;
|
|
284
284
|
}
|
|
285
|
-
|
|
285
|
+
|
|
286
286
|
if (barStyle != UIBarStyleDefault && _barTintColorLightContent) {
|
|
287
287
|
return _barTintColorLightContent;
|
|
288
288
|
}
|
|
289
|
-
|
|
289
|
+
|
|
290
290
|
if (_barTintColor) {
|
|
291
291
|
return _barTintColor;
|
|
292
292
|
}
|
|
293
|
-
|
|
293
|
+
|
|
294
294
|
if (barStyle == UIBarStyleDefault) {
|
|
295
295
|
return UIColor.whiteColor;
|
|
296
296
|
}
|
|
297
|
-
|
|
297
|
+
|
|
298
298
|
return UIColor.blackColor;
|
|
299
299
|
}
|
|
300
300
|
|
|
@@ -314,19 +314,19 @@
|
|
|
314
314
|
if (barStyle == UIBarStyleDefault && _tintColorDarkContent) {
|
|
315
315
|
return _tintColorDarkContent;
|
|
316
316
|
}
|
|
317
|
-
|
|
317
|
+
|
|
318
318
|
if (barStyle != UIBarStyleDefault && _tintColorLightContent) {
|
|
319
319
|
return _tintColorLightContent;
|
|
320
320
|
}
|
|
321
|
-
|
|
321
|
+
|
|
322
322
|
if (_tintColor) {
|
|
323
323
|
return _tintColor;
|
|
324
324
|
}
|
|
325
|
-
|
|
325
|
+
|
|
326
326
|
if (barStyle == UIBarStyleDefault) {
|
|
327
327
|
return UIColor.blackColor;
|
|
328
328
|
}
|
|
329
|
-
|
|
329
|
+
|
|
330
330
|
return UIColor.whiteColor;
|
|
331
331
|
}
|
|
332
332
|
|
|
@@ -344,22 +344,22 @@
|
|
|
344
344
|
|
|
345
345
|
- (UIColor *)titleTextColorWithBarStyle:(UIBarStyle)barStyle {
|
|
346
346
|
if (barStyle == UIBarStyleDefault && _titleTextColorDarkContent) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
347
|
+
return _titleTextColorDarkContent;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (barStyle != UIBarStyleDefault && _titleTextColorLightContent) {
|
|
351
|
+
return _titleTextColorLightContent;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (_titleTextColor) {
|
|
355
|
+
return _titleTextColor;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
if (barStyle == UIBarStyleDefault) {
|
|
359
|
+
return UIColor.blackColor;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return UIColor.whiteColor;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
@end
|
|
@@ -43,7 +43,7 @@ static GlobalStyle *globalStyle;
|
|
|
43
43
|
return self;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
- (void)setLeftBarButtonItem:(NSDictionary *
|
|
46
|
+
- (void)setLeftBarButtonItem:(NSDictionary *__nullable)item {
|
|
47
47
|
if (item) {
|
|
48
48
|
NSMutableArray *array = [[NSMutableArray alloc] init];
|
|
49
49
|
if (@available(iOS 11.0, *)) {
|
|
@@ -51,23 +51,23 @@ static GlobalStyle *globalStyle;
|
|
|
51
51
|
spacer.width = -8;
|
|
52
52
|
[array addObject:spacer];
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
UIBarButtonItem *buttonItem = [self createBarButtonItem:item];
|
|
56
56
|
UIView *customView = buttonItem.customView;
|
|
57
57
|
if ([customView isKindOfClass:[HBDBarButton class]]) {
|
|
58
|
-
HBDBarButton *button = (HBDBarButton *)customView;
|
|
58
|
+
HBDBarButton *button = (HBDBarButton *) customView;
|
|
59
59
|
button.imageEdgeInsets = buttonItem.imageInsets;
|
|
60
60
|
button.alignmentRectInsetsOverride = UIEdgeInsetsMake(0, 4, 0, -4);
|
|
61
61
|
}
|
|
62
62
|
[array addObject:buttonItem];
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
self.viewController.navigationItem.leftBarButtonItems = array;
|
|
65
65
|
} else {
|
|
66
66
|
self.viewController.navigationItem.leftBarButtonItems = nil;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
- (void)setRightBarButtonItem:(NSDictionary *
|
|
70
|
+
- (void)setRightBarButtonItem:(NSDictionary *__nullable)item {
|
|
71
71
|
if (item) {
|
|
72
72
|
NSMutableArray *array = [[NSMutableArray alloc] init];
|
|
73
73
|
if (@available(iOS 11.0, *)) {
|
|
@@ -75,16 +75,16 @@ static GlobalStyle *globalStyle;
|
|
|
75
75
|
spacer.width = -8;
|
|
76
76
|
[array addObject:spacer];
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
UIBarButtonItem *buttonItem = [self createBarButtonItem:item];
|
|
80
80
|
UIView *customView = buttonItem.customView;
|
|
81
81
|
if ([customView isKindOfClass:[HBDBarButton class]]) {
|
|
82
|
-
HBDBarButton *button = (HBDBarButton *)customView;
|
|
82
|
+
HBDBarButton *button = (HBDBarButton *) customView;
|
|
83
83
|
button.imageEdgeInsets = buttonItem.imageInsets;
|
|
84
84
|
button.alignmentRectInsetsOverride = UIEdgeInsetsMake(0, -4, 0, 4);
|
|
85
85
|
}
|
|
86
86
|
[array addObject:buttonItem];
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
self.viewController.navigationItem.rightBarButtonItems = array;
|
|
89
89
|
} else {
|
|
90
90
|
self.viewController.navigationItem.rightBarButtonItems = nil;
|
|
@@ -95,24 +95,24 @@ static GlobalStyle *globalStyle;
|
|
|
95
95
|
if (items) {
|
|
96
96
|
NSArray *barButtonItems = [self createBarButtonItems:items];
|
|
97
97
|
NSMutableArray *array = [[NSMutableArray alloc] init];
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
if (@available(iOS 11.0, *)) {
|
|
100
100
|
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:NULL];
|
|
101
101
|
spacer.width = -8;
|
|
102
102
|
[array addObject:spacer];
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
[array addObjectsFromArray:barButtonItems];
|
|
106
106
|
for (NSUInteger i = 0; i < barButtonItems.count; i++) {
|
|
107
107
|
UIBarButtonItem *buttonItem = barButtonItems[i];
|
|
108
108
|
UIView *customView = buttonItem.customView;
|
|
109
109
|
if ([customView isKindOfClass:[HBDBarButton class]]) {
|
|
110
|
-
HBDBarButton *button = (HBDBarButton *)customView;
|
|
110
|
+
HBDBarButton *button = (HBDBarButton *) customView;
|
|
111
111
|
button.imageEdgeInsets = buttonItem.imageInsets;
|
|
112
112
|
button.alignmentRectInsetsOverride = UIEdgeInsetsMake(0, 4, 0, -4);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
self.viewController.navigationItem.leftBarButtonItems = array;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -126,18 +126,18 @@ static GlobalStyle *globalStyle;
|
|
|
126
126
|
spacer.width = -8;
|
|
127
127
|
[array addObject:spacer];
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
|
|
130
130
|
[array addObjectsFromArray:barButtonItems];
|
|
131
131
|
for (NSUInteger i = 0; i < barButtonItems.count; i++) {
|
|
132
132
|
UIBarButtonItem *buttonItem = barButtonItems[i];
|
|
133
133
|
UIView *customView = buttonItem.customView;
|
|
134
134
|
if ([customView isKindOfClass:[HBDBarButton class]]) {
|
|
135
|
-
HBDBarButton *button = (HBDBarButton *)customView;
|
|
135
|
+
HBDBarButton *button = (HBDBarButton *) customView;
|
|
136
136
|
button.imageEdgeInsets = buttonItem.imageInsets;
|
|
137
137
|
button.alignmentRectInsetsOverride = UIEdgeInsetsMake(0, -4, 0, 4);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
self.viewController.navigationItem.rightBarButtonItems = array;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -145,7 +145,7 @@ static GlobalStyle *globalStyle;
|
|
|
145
145
|
- (NSArray *)createBarButtonItems:(NSArray *)items {
|
|
146
146
|
NSMutableArray *array = [[NSMutableArray alloc] init];
|
|
147
147
|
for (NSUInteger i = 0; i < items.count; i++) {
|
|
148
|
-
NSDictionary *item = [
|
|
148
|
+
NSDictionary *item = items[i];
|
|
149
149
|
[array addObject:[self createBarButtonItem:item]];
|
|
150
150
|
}
|
|
151
151
|
return array;
|
|
@@ -153,11 +153,11 @@ static GlobalStyle *globalStyle;
|
|
|
153
153
|
|
|
154
154
|
- (HBDBarButtonItem *)createBarButtonItem:(NSDictionary *)item {
|
|
155
155
|
HBDBarButtonItem *barButtonItem;
|
|
156
|
-
|
|
156
|
+
|
|
157
157
|
NSDictionary *insetsOption = item[@"insetsIOS"];
|
|
158
158
|
UIEdgeInsets insets = UIEdgeInsetsZero;
|
|
159
159
|
if (insetsOption) {
|
|
160
|
-
insets =
|
|
160
|
+
insets = [RCTConvert UIEdgeInsets:insetsOption];
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
NSDictionary *icon = item[@"icon"];
|
|
@@ -166,7 +166,7 @@ static GlobalStyle *globalStyle;
|
|
|
166
166
|
if (item[@"renderOriginal"] && [item[@"renderOriginal"] boolValue]) {
|
|
167
167
|
iconImage = [iconImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
|
|
170
170
|
barButtonItem = [[HBDBarButtonItem alloc] initWithImage:iconImage style:UIBarButtonItemStylePlain];
|
|
171
171
|
barButtonItem.imageInsets = insets;
|
|
172
172
|
} else {
|
|
@@ -174,31 +174,31 @@ static GlobalStyle *globalStyle;
|
|
|
174
174
|
barButtonItem = [[HBDBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStylePlain];
|
|
175
175
|
[barButtonItem setTitlePositionAdjustment:UIOffsetMake(insets.left, 0) forBarMetrics:UIBarMetricsDefault];
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
|
|
178
178
|
NSNumber *enabled = item[@"enabled"];
|
|
179
179
|
if (enabled) {
|
|
180
180
|
barButtonItem.enabled = [enabled boolValue];
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
|
|
183
183
|
NSString *action = item[@"action"];
|
|
184
184
|
NSString *sceneId = self.viewController.sceneId;
|
|
185
|
-
|
|
185
|
+
|
|
186
186
|
NSString *tintColor = item[@"tintColor"];
|
|
187
187
|
if (tintColor) {
|
|
188
188
|
barButtonItem.tintColor = [HBDUtils colorWithHexString:tintColor];
|
|
189
189
|
UIView *customView = barButtonItem.customView;
|
|
190
190
|
if ([customView isKindOfClass:[HBDBarButton class]]) {
|
|
191
|
-
HBDBarButton *button = (HBDBarButton *)customView;
|
|
191
|
+
HBDBarButton *button = (HBDBarButton *) customView;
|
|
192
192
|
button.tintColor = [HBDUtils colorWithHexString:tintColor];
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
|
|
195
|
+
|
|
196
196
|
if (action) {
|
|
197
197
|
barButtonItem.actionBlock = ^{
|
|
198
198
|
[HBDEventEmitter sendEvent:EVENT_NAVIGATION data:@{
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
KEY_ON: ON_BAR_BUTTON_ITEM_CLICK,
|
|
200
|
+
KEY_ACTION: action,
|
|
201
|
+
KEY_SCENE_ID: sceneId,
|
|
202
202
|
}];
|
|
203
203
|
};
|
|
204
204
|
}
|
|
@@ -207,7 +207,7 @@ static GlobalStyle *globalStyle;
|
|
|
207
207
|
|
|
208
208
|
- (void)setPassThroughTouches:(BOOL)passThrough {
|
|
209
209
|
if ([self.viewController.view isKindOfClass:[RCTRootView class]]) {
|
|
210
|
-
RCTRootView *rootView = (RCTRootView *)self.viewController.view;
|
|
210
|
+
RCTRootView *rootView = (RCTRootView *) self.viewController.view;
|
|
211
211
|
rootView.passThroughTouches = passThrough;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
@@ -14,7 +14,7 @@ UIKIT_STATIC_INLINE BOOL colorHasAlphaComponent(UIColor *color) {
|
|
|
14
14
|
return YES;
|
|
15
15
|
}
|
|
16
16
|
CGFloat red = 0;
|
|
17
|
-
CGFloat green= 0;
|
|
17
|
+
CGFloat green = 0;
|
|
18
18
|
CGFloat blue = 0;
|
|
19
19
|
CGFloat alpha = 0;
|
|
20
20
|
[color getRed:&red green:&green blue:&blue alpha:&alpha];
|
|
@@ -32,7 +32,7 @@ UIKIT_STATIC_INLINE BOOL imageHasAlphaChannel(UIImage *image) {
|
|
|
32
32
|
UIKIT_STATIC_INLINE void hbd_exchangeImplementations(Class class, SEL originalSelector, SEL swizzledSelector) {
|
|
33
33
|
Method originalMethod = class_getInstanceMethod(class, originalSelector);
|
|
34
34
|
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
BOOL success = class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod));
|
|
37
37
|
if (success) {
|
|
38
38
|
class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
|
|
@@ -45,13 +45,13 @@ UIKIT_STATIC_INLINE void hbd_exchangeImplementations(Class class, SEL originalSe
|
|
|
45
45
|
|
|
46
46
|
+ (NSDictionary *)mergeItem:(NSDictionary *)item withTarget:(NSDictionary *)target;
|
|
47
47
|
|
|
48
|
-
+ (UIColor *)colorWithHexString:
|
|
48
|
+
+ (UIColor *)colorWithHexString:(NSString *)hexString;
|
|
49
49
|
|
|
50
50
|
+ (NSString *)hexStringFromColor:(UIColor *)color;
|
|
51
51
|
|
|
52
52
|
+ (UIImage *)UIImage:(NSDictionary *)json;
|
|
53
53
|
|
|
54
|
-
+ (UIImage*)imageWithColor:(UIColor*)color;
|
|
54
|
+
+ (UIImage *)imageWithColor:(UIColor *)color;
|
|
55
55
|
|
|
56
56
|
+ (NSString *)iconUriFromUri:(NSString *)uri;
|
|
57
57
|
|