hybrid-navigation 3.1.4 → 3.1.5
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/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarFragment.java +1 -0
- package/ios/Navigator/HBDScreenNavigator.mm +22 -12
- package/ios/View/UIImage+WithBadge.mm +14 -36
- package/ios/ViewController/HBDViewController.h +2 -0
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -133,6 +133,7 @@ public class ReactTabBarFragment extends TabBarFragment {
|
|
|
133
133
|
sendSwitchTabEvent(index);
|
|
134
134
|
// restore tab bar selected index
|
|
135
135
|
setTabBarSelectedIndex(getSelectedIndex());
|
|
136
|
+
completion.run();
|
|
136
137
|
} else {
|
|
137
138
|
super.setSelectedIndex(index, completion);
|
|
138
139
|
intercepted = true;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
#import "HBDReactBridgeManager.h"
|
|
4
4
|
#import "HBDNavigationController.h"
|
|
5
|
+
#import "HBDViewController.h"
|
|
5
6
|
#import "UIViewController+HBD.h"
|
|
6
7
|
|
|
7
8
|
#import <React/RCTLog.h>
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
if (!model) {
|
|
22
23
|
return nil;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
|
|
25
26
|
NSString *moduleName = model[@"moduleName"];
|
|
26
27
|
NSDictionary *props = model[@"props"];
|
|
27
28
|
NSDictionary *options = model[@"options"];
|
|
@@ -54,27 +55,27 @@
|
|
|
54
55
|
[self handlePresentWithViewController:vc extras:extras callback:callback];
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
+
|
|
58
59
|
if ([action isEqualToString:@"dismiss"]) {
|
|
59
60
|
[self handleDismissWithViewController:vc callback:callback];
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
|
|
63
64
|
if ([action isEqualToString:@"showModal"]) {
|
|
64
65
|
[self handleShowModalWithViewController:vc extras:extras callback:callback];
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
+
|
|
68
69
|
if ([action isEqualToString:@"hideModal"]) {
|
|
69
70
|
[self handleDismissWithViewController:vc callback:callback];
|
|
70
71
|
return;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
|
|
73
74
|
if ([action isEqualToString:@"presentLayout"]) {
|
|
74
75
|
[self handlePresentLayoutWithViewController:vc extras:extras callback:callback];
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
|
|
78
79
|
if ([action isEqualToString:@"showModalLayout"]) {
|
|
79
80
|
[self handleShowModalLayoutWithViewController:vc extras:extras callback:callback];
|
|
80
81
|
return;
|
|
@@ -86,7 +87,7 @@
|
|
|
86
87
|
callback(@[NSNull.null, @NO]);
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
|
-
|
|
90
|
+
|
|
90
91
|
UIViewController *vc = [self viewControllerWithExtras:extras];
|
|
91
92
|
NSInteger requestCode = [extras[@"requestCode"] integerValue];
|
|
92
93
|
HBDNavigationController *nav = [[HBDNavigationController alloc] initWithRootViewController:vc];
|
|
@@ -106,8 +107,17 @@
|
|
|
106
107
|
HBDViewController *hbdvc = (HBDViewController *)vc;
|
|
107
108
|
animated = hbdvc.animatedTransition;
|
|
108
109
|
}
|
|
109
|
-
|
|
110
|
+
|
|
111
|
+
BOOL isOverFullScreen = vc.modalPresentationStyle == UIModalPresentationOverFullScreen;
|
|
112
|
+
UIViewController *presenting = vc.presentingViewController;
|
|
113
|
+
|
|
110
114
|
[vc dismissViewControllerAnimated:animated completion:^{
|
|
115
|
+
if (isOverFullScreen && presenting != nil) {
|
|
116
|
+
HBDViewController *hbdvc = [[HBDReactBridgeManager get] primaryViewControllerWithViewController:presenting];
|
|
117
|
+
if (hbdvc != nil) {
|
|
118
|
+
[hbdvc adjustScreenOrientation];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
111
121
|
callback(@[NSNull.null, @YES]);
|
|
112
122
|
}];
|
|
113
123
|
}
|
|
@@ -117,19 +127,19 @@
|
|
|
117
127
|
callback(@[NSNull.null, @NO]);
|
|
118
128
|
return;
|
|
119
129
|
}
|
|
120
|
-
|
|
130
|
+
|
|
121
131
|
UIViewController *vc = [self viewControllerWithExtras:extras];
|
|
122
132
|
NSInteger requestCode = [extras[@"requestCode"] integerValue];
|
|
123
133
|
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
124
134
|
vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
|
|
125
135
|
[vc setRequestCode:requestCode];
|
|
126
|
-
|
|
136
|
+
|
|
127
137
|
BOOL animated = YES;
|
|
128
138
|
if ([vc isKindOfClass:[HBDViewController class]]) {
|
|
129
139
|
HBDViewController *hbdvc = (HBDViewController *)vc;
|
|
130
140
|
animated = hbdvc.animatedTransition;
|
|
131
141
|
}
|
|
132
|
-
|
|
142
|
+
|
|
133
143
|
[presenting presentViewController:vc animated:animated completion:^{
|
|
134
144
|
callback(@[NSNull.null, @YES]);
|
|
135
145
|
}];
|
|
@@ -173,7 +183,7 @@
|
|
|
173
183
|
}
|
|
174
184
|
|
|
175
185
|
- (void)invalidate {
|
|
176
|
-
//
|
|
186
|
+
//
|
|
177
187
|
}
|
|
178
188
|
|
|
179
189
|
@end
|
|
@@ -4,53 +4,31 @@
|
|
|
4
4
|
|
|
5
5
|
- (UIImage *)withIconColor:(UIColor *)iconColor badgeColor:(UIColor *)badgeColor {
|
|
6
6
|
CGSize imageSize = self.size;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
UIImage *iconTintedImage = [self imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
|
11
|
-
[iconColor set];
|
|
12
|
-
[iconTintedImage drawAtPoint:CGPointZero];
|
|
13
|
-
}];
|
|
14
|
-
return [resultImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
static CGFloat const HBDTabBarBadgeHorizontalPadding = 8.0;
|
|
18
|
-
static CGFloat const HBDTabBarBadgeVerticalPadding = 2.0;
|
|
19
|
-
static CGFloat const HBDTabBarBadgeOffsetX = 0.0;
|
|
20
|
-
static CGFloat const HBDTabBarBadgeOffsetY = 0.0;
|
|
21
|
-
CGSize canvasSize = CGSizeMake(
|
|
22
|
-
imageSize.width + HBDTabBarBadgeHorizontalPadding * 2,
|
|
23
|
-
imageSize.height + HBDTabBarBadgeVerticalPadding * 2
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
UIGraphicsImageRenderer *render = [[UIGraphicsImageRenderer alloc] initWithSize:canvasSize];
|
|
27
|
-
|
|
7
|
+
|
|
8
|
+
UIGraphicsImageRenderer *render = [[UIGraphicsImageRenderer alloc] initWithSize:imageSize];
|
|
9
|
+
|
|
28
10
|
UIImage *resultImage = [render imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) {
|
|
29
11
|
// 创建 tint 后的图标图片
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(canvasSize.height - imageSize.height) / 2.0
|
|
34
|
-
);
|
|
35
|
-
CGRect iconFrame = CGRectMake(iconOrigin.x, iconOrigin.y, imageSize.width, imageSize.height);
|
|
36
|
-
|
|
12
|
+
if (iconColor) {
|
|
13
|
+
UIImage *iconTintedImage = [self imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
|
14
|
+
|
|
37
15
|
// 设置图标颜色并绘制
|
|
38
16
|
[iconColor set];
|
|
39
|
-
[iconTintedImage drawAtPoint:
|
|
40
|
-
|
|
17
|
+
[iconTintedImage drawAtPoint:CGPointZero];
|
|
18
|
+
} else {
|
|
19
|
+
[self drawAtPoint:CGPointZero];
|
|
20
|
+
}
|
|
21
|
+
|
|
41
22
|
// 创建徽章
|
|
42
23
|
CGSize badgeSize = CGSizeMake(8, 8);
|
|
43
|
-
CGPoint badgeOrigin = CGPointMake(
|
|
44
|
-
CGRectGetMaxX(iconFrame) + HBDTabBarBadgeOffsetX,
|
|
45
|
-
HBDTabBarBadgeOffsetY
|
|
46
|
-
);
|
|
24
|
+
CGPoint badgeOrigin = CGPointMake(imageSize.width - badgeSize.width, 0);
|
|
47
25
|
CGRect badgeRect = CGRectMake(badgeOrigin.x, badgeOrigin.y, badgeSize.width, badgeSize.height);
|
|
48
|
-
|
|
26
|
+
|
|
49
27
|
UIBezierPath *badgePath = [UIBezierPath bezierPathWithOvalInRect:badgeRect];
|
|
50
28
|
[badgeColor setFill];
|
|
51
29
|
[badgePath fill];
|
|
52
30
|
}];
|
|
53
|
-
|
|
31
|
+
|
|
54
32
|
return [resultImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
55
33
|
}
|
|
56
34
|
|
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": "3.1.
|
|
4
|
+
"version": "3.1.5",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"module": "./dist/index",
|
|
7
7
|
"types": "./dist/index.d.ts",
|