hybrid-navigation 2.20.0 → 3.0.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.
- package/HybridNavigation.podspec +7 -5
- package/README.md +17 -0
- package/android/build.gradle +56 -19
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/reactnative/hybridnavigation/Garden.java +320 -326
- package/android/src/main/java/com/reactnative/hybridnavigation/GlobalStyle.java +13 -20
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +6 -11
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridNavigationPackage.java +55 -21
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeEvent.java +31 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeGarden.java +223 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeNavigation.java +370 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactAppCompatActivity.java +239 -224
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactAppCompatActivityDelegate.java +177 -198
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactDrawerFragment.java +2 -9
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +41 -78
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactManager.java +438 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactStackFragment.java +10 -19
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBar.java +7 -15
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarFragment.java +135 -173
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarProvider.java +54 -227
- package/android/src/main/java/com/reactnative/hybridnavigation/Utils.java +2 -3
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/DrawerNavigator.java +12 -14
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java +18 -21
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/StackNavigator.java +17 -20
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/TabNavigator.java +13 -26
- package/dist/NativeEvent.d.ts +33 -0
- package/dist/NativeEvent.js +2 -0
- package/dist/NativeGarden.d.ts +18 -0
- package/dist/NativeGarden.js +2 -0
- package/dist/NativeNavigation.d.ts +47 -0
- package/dist/NativeNavigation.js +2 -0
- package/dist/Navigation.js +3 -3
- package/dist/NavigationModule.d.ts +3 -3
- package/dist/NavigationModule.js +18 -19
- package/dist/Navigator.js +1 -2
- package/dist/Options.d.ts +4 -7
- package/dist/Route.d.ts +0 -2
- package/dist/handler/BarButtonEventHandler.js +2 -2
- package/dist/handler/LayoutCommandHandler.js +3 -3
- package/dist/handler/ResultEventHandler.js +3 -3
- package/dist/handler/VisibilityEventHandler.js +11 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/ios/HybridNavigation/GlobalStyle.h +0 -6
- package/ios/HybridNavigation/{GlobalStyle.m → GlobalStyle.mm} +54 -44
- package/ios/HybridNavigation/HBDUtils.h +0 -4
- package/ios/HybridNavigation/{HBDUtils.m → HBDUtils.mm} +0 -41
- package/ios/HybridNavigation/Navigator/{HBDScreenNavigator.m → HBDScreenNavigator.mm} +3 -9
- package/ios/HybridNavigation/Navigator/{HBDStackNavigator.m → HBDStackNavigator.mm} +0 -4
- package/ios/HybridNavigation/Navigator/{HBDTabNavigator.m → HBDTabNavigator.mm} +1 -55
- package/ios/HybridNavigation/React/HBDNativeEvent.h +13 -0
- package/ios/HybridNavigation/React/HBDNativeEvent.mm +31 -0
- package/ios/HybridNavigation/React/HBDNativeGarden.h +10 -0
- package/ios/HybridNavigation/React/HBDNativeGarden.mm +151 -0
- package/ios/HybridNavigation/React/HBDNativeNavigation.h +11 -0
- package/ios/HybridNavigation/React/HBDNativeNavigation.mm +263 -0
- package/ios/HybridNavigation/{ReactBridge → React}/HBDReactBridgeManager.h +3 -1
- package/ios/HybridNavigation/{ReactBridge/HBDReactBridgeManager.m → React/HBDReactBridgeManager.mm} +7 -30
- package/ios/HybridNavigation/View/{HBDBarButtonItem.m → HBDBarButtonItem.mm} +19 -11
- package/ios/HybridNavigation/View/{HBDNavigationBar.m → HBDNavigationBar.mm} +68 -5
- package/ios/HybridNavigation/View/HBDRootView.h +2 -2
- package/ios/HybridNavigation/View/{HBDRootView.m → HBDRootView.mm} +2 -2
- package/ios/HybridNavigation/View/HBDTitleView.h +2 -2
- package/ios/HybridNavigation/View/{HBDTitleView.m → HBDTitleView.mm} +3 -3
- package/ios/HybridNavigation/View/UIImage+WithBadge.h +13 -0
- package/ios/HybridNavigation/View/UIImage+WithBadge.mm +36 -0
- package/ios/HybridNavigation/ViewController/{HBDDrawerController.m → HBDDrawerController.mm} +2 -25
- package/ios/HybridNavigation/ViewController/HBDReactViewController.h +0 -4
- package/ios/HybridNavigation/ViewController/{HBDReactViewController.m → HBDReactViewController.mm} +40 -31
- package/ios/HybridNavigation/ViewController/HBDTabBarController.h +0 -2
- package/ios/HybridNavigation/ViewController/HBDTabBarController.mm +140 -0
- package/ios/HybridNavigation/ViewController/HBDViewController+Garden.h +0 -2
- package/ios/HybridNavigation/ViewController/{HBDViewController+Garden.m → HBDViewController+Garden.mm} +8 -26
- package/ios/HybridNavigation/ViewController/HBDViewController.h +2 -0
- package/ios/HybridNavigation/ViewController/{HBDViewController.m → HBDViewController.mm} +67 -57
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.h +0 -2
- package/ios/HybridNavigation/ViewController/{UIViewController+HBD.m → UIViewController+HBD.mm} +1 -42
- package/package.json +11 -2
- package/src/DeepLink.ts +3 -3
- package/src/NativeEvent.ts +40 -0
- package/src/NativeGarden.ts +27 -0
- package/src/NativeNavigation.ts +72 -0
- package/src/Navigation.ts +13 -13
- package/src/NavigationComponentWrap.tsx +4 -4
- package/src/NavigationModule.ts +21 -46
- package/src/Navigator.ts +13 -13
- package/src/Options.ts +9 -9
- package/src/Route.ts +0 -2
- package/src/handler/BarButtonEventHandler.ts +4 -8
- package/src/handler/DispatchCommandHandler.ts +4 -8
- package/src/handler/LayoutCommandHandler.ts +4 -5
- package/src/handler/ResultEventHandler.ts +11 -27
- package/src/handler/VisibilityEventHandler.ts +23 -32
- package/src/hooks.ts +2 -2
- package/src/index.ts +4 -5
- package/src/router/drawer.ts +5 -5
- package/src/router/index.ts +15 -15
- package/src/router/screen.ts +2 -2
- package/src/router/stack.ts +4 -4
- package/src/router/tabs.ts +3 -3
- package/src/store.ts +1 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/DefaultTabBarProvider.java +0 -143
- package/android/src/main/java/com/reactnative/hybridnavigation/GardenModule.java +0 -230
- package/android/src/main/java/com/reactnative/hybridnavigation/HBDEventEmitter.java +0 -89
- package/android/src/main/java/com/reactnative/hybridnavigation/HBDReactRootView.java +0 -71
- package/android/src/main/java/com/reactnative/hybridnavigation/NavigationModule.java +0 -370
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactBridgeManager.java +0 -445
- package/dist/Event.d.ts +0 -16
- package/dist/Event.js +0 -62
- package/dist/GardenModule.d.ts +0 -24
- package/dist/GardenModule.js +0 -21
- package/ios/HybridNavigation/HBDAnimationObserver.h +0 -24
- package/ios/HybridNavigation/HBDAnimationObserver.m +0 -45
- package/ios/HybridNavigation/ReactBridge/HBDEventEmitter.h +0 -28
- package/ios/HybridNavigation/ReactBridge/HBDEventEmitter.m +0 -72
- package/ios/HybridNavigation/ReactBridge/HBDGardenModule.h +0 -6
- package/ios/HybridNavigation/ReactBridge/HBDGardenModule.m +0 -157
- package/ios/HybridNavigation/ReactBridge/HBDNavigationModule.h +0 -6
- package/ios/HybridNavigation/ReactBridge/HBDNavigationModule.m +0 -249
- package/ios/HybridNavigation/View/HBDReactTabBar.h +0 -9
- package/ios/HybridNavigation/View/HBDReactTabBar.m +0 -36
- package/ios/HybridNavigation/View/UITabBar+Badge.h +0 -9
- package/ios/HybridNavigation/View/UITabBar+Badge.m +0 -46
- package/ios/HybridNavigation/ViewController/HBDTabBarController.m +0 -265
- package/src/Event.ts +0 -117
- package/src/GardenModule.ts +0 -50
- /package/ios/HybridNavigation/Navigator/{HBDDrawerNavigator.m → HBDDrawerNavigator.mm} +0 -0
- /package/ios/HybridNavigation/Navigator/{HBDNavigatorRegistry.m → HBDNavigatorRegistry.mm} +0 -0
- /package/ios/HybridNavigation/{ReactBridge → React}/HBDNavigator.h +0 -0
- /package/ios/HybridNavigation/View/{HBDBackBarButtonItem.m → HBDBackBarButtonItem.mm} +0 -0
- /package/ios/HybridNavigation/ViewController/{HBDFadeAnimation.m → HBDFadeAnimation.mm} +0 -0
- /package/ios/HybridNavigation/ViewController/{HBDNavigationController.m → HBDNavigationController.mm} +0 -0
- /package/ios/HybridNavigation/ViewController/{HBDPopAnimation.m → HBDPopAnimation.mm} +0 -0
- /package/ios/HybridNavigation/ViewController/{HBDPushAnimation.m → HBDPushAnimation.mm} +0 -0
- /package/ios/HybridNavigation/ViewController/{UINavigationController+HBD.m → UINavigationController+HBD.mm} +0 -0
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
|
|
26
26
|
@property(nonatomic, strong) UIColor *tabBarBackgroundColor;
|
|
27
27
|
@property(nonatomic, strong) UIImage *tabBarShadowImage;
|
|
28
|
-
@property(nonatomic, strong) UIColor *
|
|
29
|
-
@property(nonatomic, strong) UIColor *
|
|
28
|
+
@property(nonatomic, strong) UIColor *tabBarItemSelectedColor;
|
|
29
|
+
@property(nonatomic, strong) UIColor *tabBarItemNormalColor;
|
|
30
30
|
|
|
31
31
|
@property(nonatomic, assign, readwrite) BOOL alwaysSplitNavigationBarTransition;
|
|
32
32
|
|
|
@@ -171,13 +171,12 @@ static GlobalStyle *globalStyle;
|
|
|
171
171
|
self.barButtonItemTextSize = 15;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
//
|
|
175
|
-
NSString *
|
|
176
|
-
if (
|
|
177
|
-
|
|
178
|
-
} else {
|
|
179
|
-
self.tabBarBackgroundColor = [HBDUtils colorWithHexString:@"#FFFFFF"];
|
|
174
|
+
// tabBarBackgroundColor
|
|
175
|
+
NSString *tabBarBackgroundColor = self.options[@"tabBarBackgroundColor"];
|
|
176
|
+
if (!tabBarBackgroundColor) {
|
|
177
|
+
tabBarBackgroundColor = @"#FFFFFF";
|
|
180
178
|
}
|
|
179
|
+
self.tabBarBackgroundColor = [HBDUtils colorWithHexString:tabBarBackgroundColor];
|
|
181
180
|
|
|
182
181
|
// shadowImage
|
|
183
182
|
NSDictionary *tabBarShadowImage = self.options[@"tabBarShadowImage"];
|
|
@@ -194,24 +193,24 @@ static GlobalStyle *globalStyle;
|
|
|
194
193
|
}
|
|
195
194
|
|
|
196
195
|
// tabBar tintColor
|
|
197
|
-
NSString *
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
196
|
+
NSString *tabBarItemSelectedColor = self.options[@"tabBarItemSelectedColor"];
|
|
197
|
+
NSString *tabBarItemNormalColor = self.options[@"tabBarItemNormalColor"];
|
|
198
|
+
if (!tabBarItemSelectedColor) {
|
|
199
|
+
tabBarItemSelectedColor = @"#FF5722";
|
|
200
|
+
}
|
|
201
|
+
if (!tabBarItemNormalColor) {
|
|
202
|
+
tabBarItemNormalColor = @"#666666";
|
|
203
|
+
}
|
|
204
|
+
self.tabBarItemSelectedColor = [HBDUtils colorWithHexString:tabBarItemSelectedColor];
|
|
205
|
+
self.tabBarItemNormalColor = [HBDUtils colorWithHexString:tabBarItemNormalColor];
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
NSString *tabBarBadgeColor = self.options[@"tabBarBadgeColor"];
|
|
209
|
+
if (!tabBarBadgeColor) {
|
|
210
|
+
tabBarBadgeColor = @"#FF3B30";
|
|
211
|
+
}
|
|
212
|
+
if (tabBarBadgeColor) {
|
|
213
|
+
[UITabBarItem appearance].badgeColor = [HBDUtils colorWithHexString:tabBarBadgeColor];
|
|
215
214
|
}
|
|
216
215
|
}
|
|
217
216
|
return self;
|
|
@@ -255,30 +254,41 @@ static GlobalStyle *globalStyle;
|
|
|
255
254
|
}
|
|
256
255
|
|
|
257
256
|
- (void)inflateTabBar:(UITabBar *)tabBar {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
257
|
+
if (@available(iOS 15.0, *)) {
|
|
258
|
+
UITabBarItemAppearance *tabBarItem = [UITabBarItemAppearance new];
|
|
259
|
+
tabBarItem.normal.titleTextAttributes = @{
|
|
260
|
+
NSForegroundColorAttributeName: self.tabBarItemNormalColor,
|
|
261
|
+
};
|
|
262
|
+
tabBarItem.normal.iconColor = self.tabBarItemNormalColor;
|
|
263
|
+
tabBarItem.selected.titleTextAttributes = @{
|
|
264
|
+
NSForegroundColorAttributeName: self.tabBarItemSelectedColor,
|
|
265
|
+
};
|
|
266
|
+
tabBarItem.selected.iconColor = self.tabBarItemSelectedColor;
|
|
267
|
+
|
|
268
|
+
UITabBarAppearance *tabBarAppearance = [UITabBarAppearance new];
|
|
269
|
+
[tabBarAppearance configureWithDefaultBackground];
|
|
270
|
+
|
|
271
|
+
tabBarAppearance.shadowImage = self.tabBarShadowImage;
|
|
272
|
+
tabBarAppearance.stackedLayoutAppearance = tabBarItem;
|
|
273
|
+
|
|
274
|
+
tabBar.scrollEdgeAppearance = tabBarAppearance;
|
|
275
|
+
tabBar.standardAppearance = tabBarAppearance;
|
|
276
|
+
}
|
|
277
|
+
|
|
267
278
|
if (self.tabBarBackgroundColor) {
|
|
268
|
-
|
|
279
|
+
if (@available(iOS 26.0, *)) {
|
|
280
|
+
//
|
|
281
|
+
} else if (@available(iOS 15.0, *)) {
|
|
282
|
+
tabBar.standardAppearance.backgroundImage = [HBDUtils imageWithColor:self.tabBarBackgroundColor];
|
|
283
|
+
} else {
|
|
284
|
+
[tabBar setBackgroundImage:[HBDUtils imageWithColor:self.tabBarBackgroundColor]];
|
|
285
|
+
}
|
|
269
286
|
}
|
|
270
287
|
|
|
271
288
|
if (self.tabBarShadowImage) {
|
|
272
289
|
[tabBar setShadowImage:self.tabBarShadowImage];
|
|
273
290
|
}
|
|
274
|
-
|
|
275
|
-
if (self.tabBarTintColor) {
|
|
276
|
-
[tabBar setTintColor:self.tabBarTintColor];
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (self.tabBarUnselectedTintColor) {
|
|
280
|
-
[tabBar setUnselectedItemTintColor:self.tabBarUnselectedTintColor];
|
|
281
|
-
}
|
|
291
|
+
|
|
282
292
|
}
|
|
283
293
|
|
|
284
294
|
- (void)setBarTintColor:(UIColor *)barTintColor {
|
|
@@ -42,12 +42,8 @@ UIKIT_STATIC_INLINE void hbd_exchangeImplementations(Class clazz, SEL originalSe
|
|
|
42
42
|
|
|
43
43
|
+ (NSString *)iconUriFromUri:(NSString *)uri;
|
|
44
44
|
|
|
45
|
-
+ (CGFloat)statusBarHeight;
|
|
46
|
-
|
|
47
45
|
+ (BOOL)isIphoneX;
|
|
48
46
|
|
|
49
|
-
+ (BOOL)isInCall;
|
|
50
|
-
|
|
51
47
|
+ (void)printViewHierarchy:(UIView *)view withPrefix:(NSString *)prefix;
|
|
52
48
|
|
|
53
49
|
@end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#import "HBDUtils.h"
|
|
2
2
|
|
|
3
|
-
#import "HBDAnimationObserver.h"
|
|
4
3
|
#import <React/RCTConvert.h>
|
|
5
4
|
|
|
6
5
|
@implementation HBDUtils
|
|
@@ -170,23 +169,6 @@
|
|
|
170
169
|
return window.safeAreaInsets.bottom > 0.0;
|
|
171
170
|
}
|
|
172
171
|
|
|
173
|
-
+ (BOOL)isInCall {
|
|
174
|
-
if ([HBDUtils isIphoneX]) {
|
|
175
|
-
return NO;
|
|
176
|
-
} else {
|
|
177
|
-
return [self statusBarHeight] == 40;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
+ (CGFloat)statusBarHeight {
|
|
182
|
-
if (@available(iOS 13.0, *)) {
|
|
183
|
-
UIStatusBarManager *statusBarManager = RCTKeyWindow().windowScene.statusBarManager;
|
|
184
|
-
return statusBarManager.statusBarFrame.size.height;
|
|
185
|
-
} else {
|
|
186
|
-
return [[UIApplication sharedApplication] statusBarFrame].size.height;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
172
|
+ (void)printViewHierarchy:(UIView *)view withPrefix:(NSString *)prefix {
|
|
191
173
|
NSString *viewName = [[[view classForCoder] description] stringByReplacingOccurrencesOfString:@"_" withString:@""];
|
|
192
174
|
NSLog(@"%@%@ %@", prefix, viewName, NSStringFromCGRect(view.frame));
|
|
@@ -197,27 +179,4 @@
|
|
|
197
179
|
}
|
|
198
180
|
}
|
|
199
181
|
|
|
200
|
-
static void (*__SWZ_didMoveToWindow_orig)(id self, SEL _cmd);
|
|
201
|
-
|
|
202
|
-
static void __HBD_didMoveToWindow(UIView *self, SEL _cmd) {
|
|
203
|
-
if (![[HBDAnimationObserver sharedObserver] isAnimating] || !self.window) {
|
|
204
|
-
__SWZ_didMoveToWindow_orig(self, _cmd);
|
|
205
|
-
} else {
|
|
206
|
-
[[HBDAnimationObserver sharedObserver] registerAnimationEndedBlock:^{
|
|
207
|
-
__SWZ_didMoveToWindow_orig(self, _cmd);
|
|
208
|
-
}];
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
+ (void)load {
|
|
213
|
-
Class clazz = NSClassFromString(@"RCTBaseTextInputView");
|
|
214
|
-
if (clazz == NULL) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
Method method = class_getInstanceMethod(clazz, NSSelectorFromString(@"didMoveToWindow"));
|
|
218
|
-
__SWZ_didMoveToWindow_orig = (void *)method_getImplementation(method);
|
|
219
|
-
method_setImplementation(method, (IMP)__HBD_didMoveToWindow);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
182
|
@end
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
#import "HBDReactBridgeManager.h"
|
|
4
4
|
#import "HBDNavigationController.h"
|
|
5
|
-
#import "HBDAnimationObserver.h"
|
|
6
5
|
#import "UIViewController+HBD.h"
|
|
7
6
|
|
|
8
7
|
#import <React/RCTLog.h>
|
|
@@ -95,8 +94,7 @@
|
|
|
95
94
|
[nav setRequestCode:requestCode];
|
|
96
95
|
[vc setRequestCode:requestCode];
|
|
97
96
|
[vc setPresentingSceneId:presenting.sceneId];
|
|
98
|
-
|
|
99
|
-
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
97
|
+
|
|
100
98
|
[presenting presentViewController:nav animated:YES completion:^{
|
|
101
99
|
callback(@[NSNull.null, @YES]);
|
|
102
100
|
}];
|
|
@@ -132,10 +130,6 @@
|
|
|
132
130
|
animated = hbdvc.animatedTransition;
|
|
133
131
|
}
|
|
134
132
|
|
|
135
|
-
if (animated) {
|
|
136
|
-
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
133
|
[presenting presentViewController:vc animated:animated completion:^{
|
|
140
134
|
callback(@[NSNull.null, @YES]);
|
|
141
135
|
}];
|
|
@@ -147,7 +141,7 @@
|
|
|
147
141
|
UIViewController *vc = [[HBDReactBridgeManager get] viewControllerWithLayout:layout];
|
|
148
142
|
[vc setRequestCode:requestCode];
|
|
149
143
|
vc.modalPresentationStyle = UIModalPresentationCurrentContext;
|
|
150
|
-
|
|
144
|
+
|
|
151
145
|
[presenting presentViewController:vc animated:YES completion:^{
|
|
152
146
|
callback(@[NSNull.null, @YES]);
|
|
153
147
|
}];
|
|
@@ -160,7 +154,7 @@
|
|
|
160
154
|
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
161
155
|
vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
|
|
162
156
|
[vc setRequestCode:requestCode];
|
|
163
|
-
|
|
157
|
+
|
|
164
158
|
[presenting presentViewController:vc animated:YES completion:^{
|
|
165
159
|
callback(@[NSNull.null, @YES]);
|
|
166
160
|
}];
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
#import "HBDReactBridgeManager.h"
|
|
4
4
|
#import "HBDNavigationController.h"
|
|
5
5
|
#import "UINavigationController+HBD.h"
|
|
6
|
-
#import "HBDAnimationObserver.h"
|
|
7
6
|
|
|
8
7
|
#import <React/RCTLog.h>
|
|
9
8
|
|
|
@@ -127,7 +126,6 @@
|
|
|
127
126
|
}
|
|
128
127
|
|
|
129
128
|
if (animated) {
|
|
130
|
-
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
131
129
|
[nav pushViewController:vc animated:YES];
|
|
132
130
|
[self animateAlongsideTransition:nav callback:callback];
|
|
133
131
|
} else {
|
|
@@ -251,7 +249,6 @@
|
|
|
251
249
|
}
|
|
252
250
|
|
|
253
251
|
if (animated) {
|
|
254
|
-
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
255
252
|
[nav redirectToViewController:vc target:target animated:YES];
|
|
256
253
|
[self animateAlongsideTransition:nav callback:callback];
|
|
257
254
|
}else {
|
|
@@ -271,7 +268,6 @@
|
|
|
271
268
|
}
|
|
272
269
|
|
|
273
270
|
vc.hidesBottomBarWhenPushed = nav.hidesBottomBarWhenPushed;
|
|
274
|
-
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
275
271
|
[nav pushViewController:vc animated:YES];
|
|
276
272
|
[self animateAlongsideTransition:nav callback:callback];
|
|
277
273
|
}
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
NSDictionary *options = model[@"options"];
|
|
34
|
-
|
|
35
|
-
HBDTabBarController *tabBarController = [self createTabBarControllerWithTabModels:tabModels options:options];
|
|
34
|
+
HBDTabBarController *tabBarController = [[HBDTabBarController alloc] init];
|
|
36
35
|
[tabBarController setViewControllers:viewControllers];
|
|
37
36
|
|
|
38
37
|
if (options) {
|
|
@@ -47,59 +46,6 @@
|
|
|
47
46
|
return tabBarController;
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
- (HBDTabBarController *)createTabBarControllerWithTabModels:(NSArray *)tabModels options:(NSDictionary *)options {
|
|
51
|
-
NSString *moduleName = options[@"tabBarModuleName"];
|
|
52
|
-
BOOL hasCustomTabBar = moduleName.length > 0;
|
|
53
|
-
|
|
54
|
-
if (!hasCustomTabBar) {
|
|
55
|
-
return [[HBDTabBarController alloc] init];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
GlobalStyle *style = [GlobalStyle globalStyle];
|
|
59
|
-
|
|
60
|
-
NSDictionary *tabBarOptions = @{
|
|
61
|
-
@"tabs": tabModels,
|
|
62
|
-
@"tabBarModuleName": moduleName,
|
|
63
|
-
@"sizeIndeterminate": options[@"sizeIndeterminate"],
|
|
64
|
-
@"selectedIndex": options[@"selectedIndex"] ?: @(0),
|
|
65
|
-
@"tabBarItemColor": style.tabBarItemColorHexString,
|
|
66
|
-
@"tabBarUnselectedItemColor": style.tabBarUnselectedItemColorHexString,
|
|
67
|
-
@"badgeColor": style.badgeColorHexString,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
return [[HBDTabBarController alloc] initWithTabBarOptions:tabBarOptions];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
- (NSArray<NSDictionary *> *)tabModelsWithViewControllers:(NSArray<UIViewController *> *)children {
|
|
74
|
-
NSUInteger count = children.count;
|
|
75
|
-
NSMutableArray *tabModels = [[NSMutableArray alloc] initWithCapacity:4];
|
|
76
|
-
|
|
77
|
-
for (NSUInteger i = 0; i < count; i++) {
|
|
78
|
-
UIViewController *vc = children[i];
|
|
79
|
-
if ([vc isKindOfClass:[UINavigationController class]]) {
|
|
80
|
-
UINavigationController *nav = (UINavigationController *) vc;
|
|
81
|
-
vc = nav.childViewControllers[0];
|
|
82
|
-
}
|
|
83
|
-
if ([vc isKindOfClass:[HBDViewController class]]) {
|
|
84
|
-
HBDViewController *hbdVC = (HBDViewController *) vc;
|
|
85
|
-
NSDictionary *tabItem = hbdVC.options[@"tabItem"];
|
|
86
|
-
if (tabItem) {
|
|
87
|
-
NSDictionary *tab = @{
|
|
88
|
-
@"index": @(i),
|
|
89
|
-
@"sceneId": hbdVC.sceneId,
|
|
90
|
-
@"moduleName": RCTNullIfNil(hbdVC.moduleName),
|
|
91
|
-
@"icon": RCTNullIfNil([HBDUtils iconUriFromUri:tabItem[@"icon"][@"uri"]]),
|
|
92
|
-
@"unselectedIcon": RCTNullIfNil([HBDUtils iconUriFromUri:tabItem[@"unselectedIcon"][@"uri"]]),
|
|
93
|
-
@"title": RCTNullIfNil(tabItem[@"title"]),
|
|
94
|
-
};
|
|
95
|
-
[tabModels addObject:tab];
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return [tabModels copy];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
49
|
- (NSDictionary *)routeGraphWithViewController:(UIViewController *)vc {
|
|
104
50
|
if (![vc isKindOfClass:[HBDTabBarController class]]) {
|
|
105
51
|
return nil;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <navigation/navigation.h>
|
|
3
|
+
#import <React/RCTInitializing.h>
|
|
4
|
+
|
|
5
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
6
|
+
|
|
7
|
+
@interface HBDNativeEvent : NativeEventSpecBase <NativeEventSpec, RCTInvalidating, RCTInitializing>
|
|
8
|
+
|
|
9
|
+
+ (instancetype)getInstance;
|
|
10
|
+
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#import "HBDNativeEvent.h"
|
|
2
|
+
#import "HBDReactBridgeManager.h"
|
|
3
|
+
#import <React-RuntimeApple/ReactCommon/RCTHost.h>
|
|
4
|
+
#import <React/RCTLog.h>
|
|
5
|
+
|
|
6
|
+
@implementation HBDNativeEvent
|
|
7
|
+
|
|
8
|
+
+ (NSString *)moduleName {
|
|
9
|
+
return @"HBDNativeEvent";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
13
|
+
return std::make_shared<facebook::react::NativeEventSpecJSI>(params);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
- (void)initialize {
|
|
17
|
+
RCTLogInfo(@"[Navigation] HBDNativeEvent#initialize");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
- (void)invalidate {
|
|
21
|
+
RCTLogInfo(@"[Navigation] HBDNativeEvent#invalidate");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
+ (HBDNativeEvent *)getInstance {
|
|
25
|
+
HBDReactBridgeManager *manager = [HBDReactBridgeManager get];
|
|
26
|
+
RCTHost *rctHost = manager.rctHost;
|
|
27
|
+
HBDNativeEvent *emmiter = [[rctHost moduleRegistry] moduleForClass:self.class];
|
|
28
|
+
return emmiter;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@end
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#import "HBDNativeGarden.h"
|
|
2
|
+
|
|
3
|
+
#import "HBDReactBridgeManager.h"
|
|
4
|
+
#import "HBDTabBarController.h"
|
|
5
|
+
#import "GlobalStyle.h"
|
|
6
|
+
#import "HBDUtils.h"
|
|
7
|
+
|
|
8
|
+
#import <React/RCTLog.h>
|
|
9
|
+
|
|
10
|
+
@interface HBDNativeGarden ()
|
|
11
|
+
|
|
12
|
+
@property(nonatomic, strong, readonly) HBDReactBridgeManager *bridgeManager;
|
|
13
|
+
|
|
14
|
+
@end
|
|
15
|
+
|
|
16
|
+
@implementation HBDNativeGarden
|
|
17
|
+
|
|
18
|
+
+ (NSString *)moduleName {
|
|
19
|
+
return @"HBDNativeGarden";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
23
|
+
return YES;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
- (dispatch_queue_t)methodQueue {
|
|
27
|
+
return dispatch_get_main_queue();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
- (instancetype)init {
|
|
31
|
+
if (self = [super init]) {
|
|
32
|
+
_bridgeManager = [HBDReactBridgeManager get];
|
|
33
|
+
}
|
|
34
|
+
return self;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
38
|
+
return std::make_shared<facebook::react::NativeGardenSpecJSI>(params);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
- (nonnull facebook::react::ModuleConstants<JS::NativeGarden::Constants::Builder>)constantsToExport {
|
|
42
|
+
JS::NativeGarden::Constants::Builder::Input input = {
|
|
43
|
+
44
|
|
44
|
+
};
|
|
45
|
+
return facebook::react::typedConstants<JS::NativeGarden::Constants::Builder>(std::move(input));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (nonnull facebook::react::ModuleConstants<JS::NativeGarden::Constants::Builder>)getConstants {
|
|
49
|
+
return [self constantsToExport];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (void)setLeftBarButtonItem:(nonnull NSString *)sceneId item:(NSDictionary * _Nullable)item {
|
|
53
|
+
HBDViewController *vc = [self viewControllerWithSceneId:sceneId];
|
|
54
|
+
if (vc) {
|
|
55
|
+
[vc updateNavigationBarOptions:@{@"leftBarButtonItem": RCTNullIfNil(item)}];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
- (void)setLeftBarButtonItems:(nonnull NSString *)sceneId items:(NSArray * _Nullable)items {
|
|
61
|
+
HBDViewController *vc = [self viewControllerWithSceneId:sceneId];
|
|
62
|
+
if (vc) {
|
|
63
|
+
[vc updateNavigationBarOptions:@{@"leftBarButtonItems": RCTNullIfNil(items)}];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
- (void)setMenuInteractive:(nonnull NSString *)sceneId enabled:(BOOL)enabled {
|
|
69
|
+
UIViewController *vc = [self.bridgeManager viewControllerBySceneId:sceneId];
|
|
70
|
+
HBDDrawerController *drawer = [vc drawerController];
|
|
71
|
+
if (drawer) {
|
|
72
|
+
drawer.menuInteractive = enabled;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
- (void)setRightBarButtonItem:(nonnull NSString *)sceneId item:(NSDictionary * _Nullable)item {
|
|
78
|
+
HBDViewController *vc = [self viewControllerWithSceneId:sceneId];
|
|
79
|
+
if (vc) {
|
|
80
|
+
[vc updateNavigationBarOptions:@{@"rightBarButtonItem": RCTNullIfNil(item)}];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
- (void)setRightBarButtonItems:(nonnull NSString *)sceneId items:(NSArray * _Nullable)items {
|
|
86
|
+
HBDViewController *vc = [self viewControllerWithSceneId:sceneId];
|
|
87
|
+
if (vc) {
|
|
88
|
+
[vc updateNavigationBarOptions:@{@"rightBarButtonItems": RCTNullIfNil(items)}];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
- (void)setStyle:(nonnull NSDictionary *)style {
|
|
94
|
+
[GlobalStyle createWithOptions:style];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
- (void)setTabItem:(nonnull NSString *)sceneId item:(nonnull NSArray *)item {
|
|
99
|
+
RCTLogInfo(@"[Navigation] setTabItem: %@", item);
|
|
100
|
+
UIViewController *vc = [self.bridgeManager viewControllerBySceneId:sceneId];
|
|
101
|
+
UITabBarController *tabBarController = [self tabBarControllerWithViewController:vc];
|
|
102
|
+
if ([tabBarController isKindOfClass:[HBDTabBarController class]]) {
|
|
103
|
+
HBDTabBarController *tabBarVC = (HBDTabBarController *)tabBarController;
|
|
104
|
+
[tabBarVC setTabItem:item];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
- (void)setTitleItem:(nonnull NSString *)sceneId item:(nonnull NSDictionary *)item {
|
|
110
|
+
HBDViewController *vc = [self viewControllerWithSceneId:sceneId];
|
|
111
|
+
if (vc) {
|
|
112
|
+
[vc updateNavigationBarOptions:@{@"titleItem": RCTNullIfNil(item)}];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
- (void)updateOptions:(nonnull NSString *)sceneId options:(nonnull NSDictionary *)options {
|
|
118
|
+
RCTLogInfo(@"[Navigation] updateNavigationBarOptions: %@", options);
|
|
119
|
+
HBDViewController *vc = [self viewControllerWithSceneId:sceneId];
|
|
120
|
+
if (vc) {
|
|
121
|
+
[vc updateNavigationBarOptions:options];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
- (void)updateTabBar:(nonnull NSString *)sceneId item:(nonnull NSDictionary *)item {
|
|
127
|
+
RCTLogInfo(@"[Navigation] updateTabBar: %@", item);
|
|
128
|
+
UIViewController *vc = [self.bridgeManager viewControllerBySceneId:sceneId];
|
|
129
|
+
UITabBarController *tabBarVC = [self tabBarControllerWithViewController:vc];
|
|
130
|
+
if (tabBarVC && [tabBarVC isKindOfClass:[HBDTabBarController class]]) {
|
|
131
|
+
[((HBDTabBarController *)tabBarVC) updateTabBar:item];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
- (HBDViewController *)viewControllerWithSceneId:(NSString *)sceneId {
|
|
136
|
+
UIViewController *vc = [self.bridgeManager viewControllerBySceneId:sceneId];
|
|
137
|
+
if ([vc isKindOfClass:[HBDViewController class]]) {
|
|
138
|
+
return (HBDViewController *)vc;
|
|
139
|
+
}
|
|
140
|
+
return nil;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
- (UITabBarController *)tabBarControllerWithViewController:(UIViewController *)vc {
|
|
144
|
+
if ([vc isKindOfClass:[UITabBarController class]]) {
|
|
145
|
+
return (UITabBarController *)vc;
|
|
146
|
+
} else {
|
|
147
|
+
return vc.tabBarController;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <navigation/navigation.h>
|
|
3
|
+
#import <React/RCTInitializing.h>
|
|
4
|
+
|
|
5
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
6
|
+
|
|
7
|
+
@interface HBDNativeNavigation : NSObject <NativeNavigationSpec, RCTInitializing, RCTInvalidating>
|
|
8
|
+
|
|
9
|
+
@end
|
|
10
|
+
|
|
11
|
+
NS_ASSUME_NONNULL_END
|