hybrid-navigation 3.1.5 → 4.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.
Files changed (147) hide show
  1. package/README.md +4 -4
  2. package/android/build.gradle +1 -2
  3. package/android/src/main/java/androidx/fragment/app/InternalFragment.java +22 -0
  4. package/android/src/main/java/com/navigation/androidx/AppUtils.java +54 -0
  5. package/android/src/main/java/com/navigation/androidx/AwesomeActivity.java +211 -0
  6. package/android/src/main/java/com/navigation/androidx/AwesomeFragment.java +685 -0
  7. package/android/src/main/java/com/navigation/androidx/BarStyle.java +7 -0
  8. package/android/src/main/java/com/navigation/androidx/DefaultTabBarProvider.java +89 -0
  9. package/android/src/main/java/com/navigation/androidx/DrawableUtils.java +57 -0
  10. package/android/src/main/java/com/navigation/androidx/DrawerFragment.java +392 -0
  11. package/android/src/main/java/com/navigation/androidx/FragmentHelper.java +318 -0
  12. package/android/src/main/java/com/navigation/androidx/LifecycleDelegate.java +86 -0
  13. package/android/src/main/java/com/navigation/androidx/PresentableActivity.java +23 -0
  14. package/android/src/main/java/com/navigation/androidx/PresentationDelegate.java +195 -0
  15. package/android/src/main/java/com/navigation/androidx/PresentationStyle.java +5 -0
  16. package/android/src/main/java/com/navigation/androidx/StackDelegate.java +111 -0
  17. package/android/src/main/java/com/navigation/androidx/StackFragment.java +287 -0
  18. package/android/src/main/java/com/navigation/androidx/StackLayoutInflater.java +34 -0
  19. package/android/src/main/java/com/navigation/androidx/Style.java +141 -0
  20. package/android/src/main/java/com/navigation/androidx/SystemUI.java +240 -0
  21. package/android/src/main/java/com/navigation/androidx/SystemUI30.java +87 -0
  22. package/android/src/main/java/com/navigation/androidx/TabBar.java +353 -0
  23. package/android/src/main/java/com/navigation/androidx/TabBarFragment.java +313 -0
  24. package/android/src/main/java/com/navigation/androidx/TabBarItem.java +102 -0
  25. package/android/src/main/java/com/navigation/androidx/TabBarProvider.java +30 -0
  26. package/android/src/main/java/com/navigation/androidx/TabView.java +226 -0
  27. package/android/src/main/java/com/navigation/androidx/TransitionAnimation.java +31 -0
  28. package/android/src/main/java/com/reactnative/hybridnavigation/Garden.java +6 -243
  29. package/android/src/main/java/com/reactnative/hybridnavigation/GlobalStyle.java +8 -141
  30. package/android/src/main/java/com/reactnative/hybridnavigation/HBDRootView.java +4 -68
  31. package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +12 -61
  32. package/android/src/main/java/com/reactnative/hybridnavigation/NativeGarden.java +0 -47
  33. package/android/src/main/java/com/reactnative/hybridnavigation/Parameters.java +3 -3
  34. package/android/src/main/java/com/reactnative/hybridnavigation/ReactAppCompatActivityDelegate.java +2 -0
  35. package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +1 -88
  36. package/android/src/main/java/com/reactnative/hybridnavigation/ReactManager.java +0 -5
  37. package/android/src/main/java/com/reactnative/hybridnavigation/ReactStackFragment.java +0 -18
  38. package/android/src/main/java/com/reactnative/hybridnavigation/Utils.java +1 -10
  39. package/android/src/main/res/anim/{nav_push_translucent_enter.xml → nav_delay.xml} +1 -1
  40. package/android/src/main/res/anim/{nav_pop_translucent_enter.xml → nav_dismiss_enter.xml} +1 -1
  41. package/android/src/main/res/anim/nav_dismiss_exit.xml +6 -0
  42. package/android/src/main/res/anim/nav_fade_in.xml +5 -0
  43. package/android/src/main/res/anim/nav_fade_out.xml +5 -0
  44. package/android/src/main/res/anim/nav_pop_enter.xml +6 -0
  45. package/android/src/main/res/anim/nav_pop_exit.xml +6 -0
  46. package/android/src/main/res/anim/nav_present_enter.xml +6 -0
  47. package/android/src/main/res/anim/{nav_pop_translucent_exit.xml → nav_present_exit.xml} +1 -1
  48. package/android/src/main/res/anim/nav_push_enter.xml +6 -0
  49. package/android/src/main/res/anim/{nav_push_translucent_exit.xml → nav_push_exit.xml} +2 -1
  50. package/android/src/main/res/drawable/nav_dot_badge_background.xml +5 -0
  51. package/android/src/main/res/drawable/nav_text_badge_background.xml +5 -0
  52. package/android/src/main/res/drawable-v21/nav_toolbar_button_item_background.xml +24 -0
  53. package/android/src/main/res/layout/nav_fragment_drawer.xml +23 -0
  54. package/android/src/main/res/layout/nav_fragment_navigation.xml +7 -0
  55. package/android/src/main/res/layout/nav_fragment_tabbar.xml +13 -0
  56. package/android/src/main/res/layout/nav_tab_bar_container.xml +15 -0
  57. package/android/src/main/res/layout/nav_tab_bar_item.xml +49 -0
  58. package/android/src/main/res/values/dimens.xml +11 -0
  59. package/android/src/main/res/values/strings.xml +1 -0
  60. package/dist/{NativeEvent.d.ts → src/NativeEvent.d.ts} +0 -5
  61. package/dist/{NativeGarden.d.ts → src/NativeGarden.d.ts} +0 -5
  62. package/dist/{Navigation.d.ts → src/Navigation.d.ts} +1 -11
  63. package/dist/{Navigation.js → src/Navigation.js} +1 -31
  64. package/dist/{Navigator.js → src/Navigator.js} +0 -4
  65. package/dist/src/Options.d.ts +61 -0
  66. package/dist/src/Options.js +2 -0
  67. package/ios/GlobalStyle.h +1 -9
  68. package/ios/GlobalStyle.mm +48 -310
  69. package/ios/HBDUtils.h +0 -14
  70. package/ios/HBDUtils.mm +1 -116
  71. package/ios/HybridNavigation.h +0 -3
  72. package/ios/Navigator/HBDScreenNavigator.mm +12 -4
  73. package/ios/Navigator/HBDStackNavigator.mm +36 -39
  74. package/ios/React/HBDNativeGarden.mm +0 -40
  75. package/ios/React/HBDNativeNavigation.mm +21 -16
  76. package/ios/View/HBDRootView.h +0 -2
  77. package/ios/View/HBDRootView.mm +0 -21
  78. package/ios/ViewController/HBDDrawerController.mm +3 -11
  79. package/ios/ViewController/HBDFadeAnimation.mm +10 -26
  80. package/ios/ViewController/HBDNavigationController.h +0 -6
  81. package/ios/ViewController/HBDNavigationController.mm +42 -661
  82. package/ios/ViewController/HBDReactViewController.mm +7 -101
  83. package/ios/ViewController/HBDTabBarController.mm +10 -6
  84. package/ios/ViewController/HBDViewController.mm +58 -182
  85. package/ios/ViewController/UINavigationController+HBD.mm +0 -3
  86. package/ios/ViewController/UIViewController+HBD.h +0 -9
  87. package/ios/ViewController/UIViewController+HBD.mm +1 -131
  88. package/package.json +1 -1
  89. package/src/NativeEvent.ts +0 -6
  90. package/src/NativeGarden.ts +0 -11
  91. package/src/Navigation.ts +2 -68
  92. package/src/Navigator.ts +0 -5
  93. package/src/Options.ts +2 -76
  94. package/dist/Options.d.ts +0 -129
  95. package/dist/Options.js +0 -6
  96. package/dist/handler/BarButtonEventHandler.d.ts +0 -10
  97. package/dist/handler/BarButtonEventHandler.js +0 -38
  98. package/ios/View/HBDBackBarButtonItem.h +0 -9
  99. package/ios/View/HBDBackBarButtonItem.mm +0 -13
  100. package/ios/View/HBDBarButtonItem.h +0 -24
  101. package/ios/View/HBDBarButtonItem.mm +0 -69
  102. package/ios/View/HBDNavigationBar.h +0 -15
  103. package/ios/View/HBDNavigationBar.mm +0 -207
  104. package/ios/View/HBDTitleView.h +0 -7
  105. package/ios/View/HBDTitleView.mm +0 -66
  106. package/ios/ViewController/HBDPopAnimation.h +0 -9
  107. package/ios/ViewController/HBDPopAnimation.mm +0 -27
  108. package/ios/ViewController/HBDPushAnimation.h +0 -9
  109. package/ios/ViewController/HBDPushAnimation.mm +0 -28
  110. package/ios/ViewController/HBDViewController+Garden.h +0 -17
  111. package/ios/ViewController/HBDViewController+Garden.mm +0 -183
  112. package/src/handler/BarButtonEventHandler.ts +0 -50
  113. /package/dist/{DeepLink.d.ts → src/DeepLink.d.ts} +0 -0
  114. /package/dist/{DeepLink.js → src/DeepLink.js} +0 -0
  115. /package/dist/{NativeEvent.js → src/NativeEvent.js} +0 -0
  116. /package/dist/{NativeGarden.js → src/NativeGarden.js} +0 -0
  117. /package/dist/{NativeNavigation.d.ts → src/NativeNavigation.d.ts} +0 -0
  118. /package/dist/{NativeNavigation.js → src/NativeNavigation.js} +0 -0
  119. /package/dist/{NavigationComponentWrap.d.ts → src/NavigationComponentWrap.d.ts} +0 -0
  120. /package/dist/{NavigationComponentWrap.js → src/NavigationComponentWrap.js} +0 -0
  121. /package/dist/{Navigator.d.ts → src/Navigator.d.ts} +0 -0
  122. /package/dist/{Route.d.ts → src/Route.d.ts} +0 -0
  123. /package/dist/{Route.js → src/Route.js} +0 -0
  124. /package/dist/{handler → src/handler}/DispatchCommandHandler.d.ts +0 -0
  125. /package/dist/{handler → src/handler}/DispatchCommandHandler.js +0 -0
  126. /package/dist/{handler → src/handler}/LayoutCommandHandler.d.ts +0 -0
  127. /package/dist/{handler → src/handler}/LayoutCommandHandler.js +0 -0
  128. /package/dist/{handler → src/handler}/ResultEventHandler.d.ts +0 -0
  129. /package/dist/{handler → src/handler}/ResultEventHandler.js +0 -0
  130. /package/dist/{handler → src/handler}/VisibilityEventHandler.d.ts +0 -0
  131. /package/dist/{handler → src/handler}/VisibilityEventHandler.js +0 -0
  132. /package/dist/{hooks.d.ts → src/hooks.d.ts} +0 -0
  133. /package/dist/{hooks.js → src/hooks.js} +0 -0
  134. /package/dist/{index.d.ts → src/index.d.ts} +0 -0
  135. /package/dist/{index.js → src/index.js} +0 -0
  136. /package/dist/{router → src/router}/drawer.d.ts +0 -0
  137. /package/dist/{router → src/router}/drawer.js +0 -0
  138. /package/dist/{router → src/router}/index.d.ts +0 -0
  139. /package/dist/{router → src/router}/index.js +0 -0
  140. /package/dist/{router → src/router}/screen.d.ts +0 -0
  141. /package/dist/{router → src/router}/screen.js +0 -0
  142. /package/dist/{router → src/router}/stack.d.ts +0 -0
  143. /package/dist/{router → src/router}/stack.js +0 -0
  144. /package/dist/{router → src/router}/tabs.d.ts +0 -0
  145. /package/dist/{router → src/router}/tabs.js +0 -0
  146. /package/dist/{store.d.ts → src/store.d.ts} +0 -0
  147. /package/dist/{store.js → src/store.js} +0 -0
@@ -2,49 +2,24 @@
2
2
 
3
3
  #import "HBDUtils.h"
4
4
 
5
- #import <React/RCTUtils.h>
6
-
7
5
  @interface GlobalStyle ()
8
6
 
9
7
  @property(nonatomic, copy, readonly) NSDictionary *options;
10
-
11
- @property(nonatomic, assign) UIBarStyle barStyle;
12
- @property(nonatomic, strong) UIImage *shadowImage;
13
- @property(nonatomic, strong) UIImage *backIcon;
14
- @property(nonatomic, strong) UIColor *barTintColor;
15
- @property(nonatomic, strong) UIColor *barTintColorDarkContent;
16
- @property(nonatomic, strong) UIColor *barTintColorLightContent;
17
- @property(nonatomic, strong) UIColor *tintColor;
18
- @property(nonatomic, strong) UIColor *tintColorDarkContent;
19
- @property(nonatomic, strong) UIColor *tintColorLightContent;
20
- @property(nonatomic, strong) UIColor *titleTextColor;
21
- @property(nonatomic, strong) UIColor *titleTextColorDarkContent;
22
- @property(nonatomic, strong) UIColor *titleTextColorLightContent;
23
- @property(nonatomic, assign) NSInteger titleTextSize;
24
- @property(nonatomic, assign) NSInteger barButtonItemTextSize;
8
+ @property(nonatomic, assign, readwrite) UIBarStyle statusBarStyle;
25
9
 
26
10
  @property(nonatomic, strong) UIColor *tabBarBackgroundColor;
27
11
  @property(nonatomic, strong) UIImage *tabBarShadowImage;
28
12
  @property(nonatomic, strong) UIColor *tabBarItemSelectedColor;
29
13
  @property(nonatomic, strong) UIColor *tabBarItemNormalColor;
30
14
 
31
- @property(nonatomic, assign, readwrite) BOOL alwaysSplitNavigationBarTransition;
32
- @property(nonatomic, assign, readwrite, getter=isTopBarHidden) BOOL topBarHidden;
33
-
34
15
  @end
35
16
 
36
- @implementation GlobalStyle {
37
- UIColor *_barTintColor;
38
- UIColor *_tintColor;
39
- UIColor *_titleTextColor;
40
- }
17
+ @implementation GlobalStyle
41
18
 
42
19
  static GlobalStyle *globalStyle;
43
20
 
44
21
  + (void)createWithOptions:(NSDictionary *)options {
45
22
  globalStyle = [[GlobalStyle alloc] initWithOptions:options];
46
- [globalStyle inflateNavigationBar:[UINavigationBar appearance]];
47
- [globalStyle inflateBarButtonItem:[UIBarButtonItem appearance]];
48
23
  [globalStyle inflateTabBar:[UITabBar appearance]];
49
24
  }
50
25
 
@@ -60,7 +35,6 @@ static GlobalStyle *globalStyle;
60
35
  _options = options;
61
36
  _interfaceOrientation = UIInterfaceOrientationMaskPortrait;
62
37
 
63
- // screenBackgroundColor
64
38
  NSString *screenBackgroundColor = options[@"screenBackgroundColor"];
65
39
  if (screenBackgroundColor) {
66
40
  _screenBackgroundColor = [HBDUtils colorWithHexString:screenBackgroundColor];
@@ -68,319 +42,83 @@ static GlobalStyle *globalStyle;
68
42
  _screenBackgroundColor = UIColor.whiteColor;
69
43
  }
70
44
 
71
- NSString *topBarStyle = self.options[@"topBarStyle"];
72
- if (topBarStyle && [topBarStyle isEqualToString:@"light-content"]) {
73
- self.barStyle = UIBarStyleBlack;
74
- } else {
75
- self.barStyle = UIBarStyleDefault;
76
- }
77
-
78
- // topBarColor
79
- NSString *topBarColor = self.options[@"topBarColor"];
80
- if (topBarColor) {
81
- self.barTintColor = [HBDUtils colorWithHexString:topBarColor];
82
- }
83
-
84
- NSNumber *splitTopBarTransitionIOS = self.options[@"splitTopBarTransitionIOS"];
85
- if (splitTopBarTransitionIOS) {
86
- self.alwaysSplitNavigationBarTransition = [splitTopBarTransitionIOS boolValue];
87
- }
88
-
89
- NSNumber *topBarHidden = self.options[@"topBarHidden"];
90
- if (topBarHidden) {
91
- self.topBarHidden = [topBarHidden boolValue];
92
- }
93
-
94
- NSString *topBarColorDarkContent = self.options[@"topBarColorDarkContent"];
95
- if (topBarColorDarkContent) {
96
- self.barTintColorDarkContent = [HBDUtils colorWithHexString:topBarColorDarkContent];
97
- }
98
-
99
- NSString *topBarColorLightContent = self.options[@"topBarColorLightContent"];
100
- if (topBarColorLightContent) {
101
- self.barTintColorLightContent = [HBDUtils colorWithHexString:topBarColorLightContent];
102
- }
103
-
104
- // navigationBar shadowImage
105
- NSDictionary *shadowImage = self.options[@"shadowImage"];
106
- if (RCTNilIfNull(shadowImage)) {
107
- UIImage *image = [UIImage new];
108
- NSDictionary *imageItem = shadowImage[@"image"];
109
- NSString *color = shadowImage[@"color"];
110
- if (imageItem) {
111
- image = [HBDUtils UIImage:imageItem];
112
- } else if (color) {
113
- image = [HBDUtils imageWithColor:[HBDUtils colorWithHexString:color]];
114
- }
115
- self.shadowImage = image;
116
- }
117
-
118
- // hideBackTitle
119
- NSNumber *hideBackTitle = options[@"hideBackTitleIOS"];
120
- if (!hideBackTitle) {
121
- hideBackTitle = options[@"hideBackTitle"];
122
- }
123
- if (hideBackTitle) {
124
- _backTitleHidden = [hideBackTitle boolValue];
125
- }
126
-
127
- // backIcon
128
- NSDictionary *backIcon = self.options[@"backIcon"];
129
- if (backIcon) {
130
- self.backIcon = [HBDUtils UIImage:backIcon];
131
- }
132
-
133
- // topBarTintColor,
134
- NSString *topBarTintColor = self.options[@"topBarTintColor"];
135
- if (topBarTintColor) {
136
- self.tintColor = [HBDUtils colorWithHexString:topBarTintColor];
137
- }
138
-
139
- NSString *topBarTintColorDarkContent = self.options[@"topBarTintColorDarkContent"];
140
- if (topBarTintColorDarkContent) {
141
- self.tintColorDarkContent = [HBDUtils colorWithHexString:topBarTintColorDarkContent];
142
- }
143
-
144
- NSString *topBarTintColorLightContent = self.options[@"topBarTintColorLightContent"];
145
- if (topBarTintColorLightContent) {
146
- self.tintColorLightContent = [HBDUtils colorWithHexString:topBarTintColorLightContent];
147
- }
148
-
149
- // titleTextColor,
150
- NSString *titleTextColor = self.options[@"titleTextColor"];
151
- if (titleTextColor) {
152
- self.titleTextColor = [HBDUtils colorWithHexString:titleTextColor];
153
- }
154
-
155
- NSString *titleTextColorDarkContent = self.options[@"titleTextColorDarkContent"];
156
- if (titleTextColorDarkContent) {
157
- self.titleTextColorDarkContent = [HBDUtils colorWithHexString:titleTextColorDarkContent];
158
- }
159
-
160
- NSString *titleTextColorLightContent = self.options[@"titleTextColorLightContent"];
161
- if (titleTextColorLightContent) {
162
- self.titleTextColorLightContent = [HBDUtils colorWithHexString:titleTextColorLightContent];
163
- }
164
-
165
- // titleTextSize
166
- NSNumber *titleTextSize = self.options[@"titleTextSize"];
167
- if (titleTextSize) {
168
- self.titleTextSize = [titleTextSize integerValue];
169
- } else {
170
- self.titleTextSize = 17;
171
- }
172
-
173
- NSNumber *barButtonItemTextSize = self.options[@"barButtonItemTextSize"];
174
- if (barButtonItemTextSize) {
175
- self.barButtonItemTextSize = [barButtonItemTextSize integerValue];
45
+ NSString *statusBarStyle = options[@"statusBarStyle"];
46
+ if (statusBarStyle && [statusBarStyle isEqualToString:@"light-content"]) {
47
+ _statusBarStyle = UIBarStyleBlack;
176
48
  } else {
177
- self.barButtonItemTextSize = 15;
49
+ _statusBarStyle = UIBarStyleDefault;
178
50
  }
179
51
 
180
- // tabBarBackgroundColor
181
- NSString *tabBarBackgroundColor = self.options[@"tabBarBackgroundColor"];
52
+ NSString *tabBarBackgroundColor = options[@"tabBarBackgroundColor"];
182
53
  if (!tabBarBackgroundColor) {
183
- tabBarBackgroundColor = @"#FFFFFF";
54
+ tabBarBackgroundColor = @"#FFFFFF";
184
55
  }
185
- self.tabBarBackgroundColor = [HBDUtils colorWithHexString:tabBarBackgroundColor];
56
+ self.tabBarBackgroundColor = [HBDUtils colorWithHexString:tabBarBackgroundColor];
186
57
 
187
- // shadowImage
188
- NSDictionary *tabBarShadowImage = self.options[@"tabBarShadowImage"];
189
- if (RCTNilIfNull(tabBarShadowImage)) {
58
+ NSDictionary *tabBarShadowImage = options[@"tabBarShadowImage"];
59
+ if ([tabBarShadowImage isKindOfClass:[NSDictionary class]]) {
190
60
  UIImage *image = [UIImage new];
191
61
  NSDictionary *imageItem = tabBarShadowImage[@"image"];
192
62
  NSString *color = tabBarShadowImage[@"color"];
193
- if (imageItem) {
63
+ if ([imageItem isKindOfClass:[NSDictionary class]]) {
194
64
  image = [HBDUtils UIImage:imageItem];
195
- } else if (color) {
65
+ } else if ([color isKindOfClass:[NSString class]]) {
196
66
  image = [HBDUtils imageWithColor:[HBDUtils colorWithHexString:color]];
197
67
  }
198
68
  self.tabBarShadowImage = image;
199
69
  }
200
70
 
201
- // tabBar tintColor
202
- NSString *tabBarItemSelectedColor = self.options[@"tabBarItemSelectedColor"];
203
- NSString *tabBarItemNormalColor = self.options[@"tabBarItemNormalColor"];
204
- if (!tabBarItemSelectedColor) {
205
- tabBarItemSelectedColor = @"#FF5722";
206
- }
207
- if (!tabBarItemNormalColor) {
208
- tabBarItemNormalColor = @"#666666";
209
- }
210
- self.tabBarItemSelectedColor = [HBDUtils colorWithHexString:tabBarItemSelectedColor];
211
- self.tabBarItemNormalColor = [HBDUtils colorWithHexString:tabBarItemNormalColor];
212
-
71
+ NSString *tabBarItemSelectedColor = options[@"tabBarItemSelectedColor"];
72
+ NSString *tabBarItemNormalColor = options[@"tabBarItemNormalColor"];
73
+ if (!tabBarItemSelectedColor) {
74
+ tabBarItemSelectedColor = @"#FF5722";
75
+ }
76
+ if (!tabBarItemNormalColor) {
77
+ tabBarItemNormalColor = @"#666666";
78
+ }
79
+ self.tabBarItemSelectedColor = [HBDUtils colorWithHexString:tabBarItemSelectedColor];
80
+ self.tabBarItemNormalColor = [HBDUtils colorWithHexString:tabBarItemNormalColor];
213
81
 
214
- NSString *tabBarBadgeColor = self.options[@"tabBarBadgeColor"];
215
- if (!tabBarBadgeColor) {
216
- tabBarBadgeColor = @"#FF3B30";
217
- }
218
- if (tabBarBadgeColor) {
219
- [UITabBarItem appearance].badgeColor = [HBDUtils colorWithHexString:tabBarBadgeColor];
82
+ NSString *tabBarBadgeColor = options[@"tabBarBadgeColor"];
83
+ if (!tabBarBadgeColor) {
84
+ tabBarBadgeColor = @"#FF3B30";
220
85
  }
86
+ [UITabBarItem appearance].badgeColor = [HBDUtils colorWithHexString:tabBarBadgeColor];
221
87
  }
222
88
  return self;
223
89
  }
224
90
 
225
- - (void)inflateNavigationBar:(UINavigationBar *)navigationBar {
226
-
227
- [navigationBar setBarStyle:self.barStyle];
228
- if (self.barTintColor) {
229
- [navigationBar setBarTintColor:self.barTintColor];
230
- }
231
-
232
- if (self.shadowImage) {
233
- [navigationBar setShadowImage:self.shadowImage];
234
- }
235
-
236
- if (self.backIcon) {
237
- [navigationBar setBackIndicatorImage:self.backIcon];
238
- [navigationBar setBackIndicatorTransitionMaskImage:self.backIcon];
239
- }
240
-
241
- if (self.tintColor) {
242
- [navigationBar setTintColor:self.tintColor];
243
- }
244
-
245
- // title
246
- NSMutableDictionary *titleAttributes = [[NSMutableDictionary alloc] init];
247
- if (self.titleTextColor) {
248
- titleAttributes[NSForegroundColorAttributeName] = self.titleTextColor;
249
- }
250
- titleAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:self.titleTextSize];
251
- [navigationBar setTitleTextAttributes:titleAttributes];
252
- }
253
-
254
- - (void)inflateBarButtonItem:(UIBarButtonItem *)barButtonItem {
255
- NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init];
256
- attributes[NSFontAttributeName] = [UIFont systemFontOfSize:self.barButtonItemTextSize];
257
- [barButtonItem setTitleTextAttributes:attributes forState:UIControlStateNormal];
258
- [barButtonItem setTitleTextAttributes:attributes forState:UIControlStateHighlighted];
259
- [barButtonItem setTitleTextAttributes:attributes forState:UIControlStateDisabled];
260
- }
261
-
262
91
  - (void)inflateTabBar:(UITabBar *)tabBar {
263
- UITabBarItemAppearance *tabBarItem = [UITabBarItemAppearance new];
264
- tabBarItem.normal.titleTextAttributes = @{
265
- NSForegroundColorAttributeName: self.tabBarItemNormalColor,
266
- };
267
- tabBarItem.normal.iconColor = self.tabBarItemNormalColor;
268
- tabBarItem.selected.titleTextAttributes = @{
269
- NSForegroundColorAttributeName: self.tabBarItemSelectedColor,
270
- };
271
- tabBarItem.selected.iconColor = self.tabBarItemSelectedColor;
92
+ UITabBarItemAppearance *tabBarItem = [UITabBarItemAppearance new];
93
+ tabBarItem.normal.titleTextAttributes = @{
94
+ NSForegroundColorAttributeName: self.tabBarItemNormalColor,
95
+ };
96
+ tabBarItem.normal.iconColor = self.tabBarItemNormalColor;
97
+ tabBarItem.selected.titleTextAttributes = @{
98
+ NSForegroundColorAttributeName: self.tabBarItemSelectedColor,
99
+ };
100
+ tabBarItem.selected.iconColor = self.tabBarItemSelectedColor;
272
101
 
273
- UITabBarAppearance *tabBarAppearance = [UITabBarAppearance new];
274
- [tabBarAppearance configureWithDefaultBackground];
102
+ UITabBarAppearance *tabBarAppearance = [UITabBarAppearance new];
103
+ [tabBarAppearance configureWithDefaultBackground];
275
104
 
276
- tabBarAppearance.shadowImage = self.tabBarShadowImage;
277
- tabBarAppearance.stackedLayoutAppearance = tabBarItem;
105
+ tabBarAppearance.shadowImage = self.tabBarShadowImage;
106
+ tabBarAppearance.stackedLayoutAppearance = tabBarItem;
107
+
108
+ tabBar.scrollEdgeAppearance = tabBarAppearance;
109
+ tabBar.standardAppearance = tabBarAppearance;
278
110
 
279
- tabBar.scrollEdgeAppearance = tabBarAppearance;
280
- tabBar.standardAppearance = tabBarAppearance;
281
-
282
111
  if (self.tabBarBackgroundColor) {
283
- if (@available(iOS 26.0, *)) {
284
- //
285
- } else {
286
- tabBar.standardAppearance.backgroundImage = [HBDUtils imageWithColor:self.tabBarBackgroundColor];
287
- }
112
+ if (@available(iOS 26.0, *)) {
113
+ //
114
+ } else {
115
+ tabBar.standardAppearance.backgroundImage = [HBDUtils imageWithColor:self.tabBarBackgroundColor];
116
+ }
288
117
  }
289
118
 
290
119
  if (self.tabBarShadowImage) {
291
120
  [tabBar setShadowImage:self.tabBarShadowImage];
292
121
  }
293
-
294
- }
295
-
296
- - (void)setBarTintColor:(UIColor *)barTintColor {
297
- _barTintColor = barTintColor;
298
- _barTintColorDarkContent = barTintColor;
299
- _barTintColorLightContent = barTintColor;
300
- }
301
-
302
- - (UIColor *)barTintColor {
303
- return [self barTintColorWithBarStyle:_barStyle];
304
- }
305
-
306
- - (UIColor *)barTintColorWithBarStyle:(UIBarStyle)barStyle {
307
- if (barStyle == UIBarStyleDefault && _barTintColorDarkContent) {
308
- return _barTintColorDarkContent;
309
- }
310
-
311
- if (barStyle != UIBarStyleDefault && _barTintColorLightContent) {
312
- return _barTintColorLightContent;
313
- }
314
-
315
- if (_barTintColor) {
316
- return _barTintColor;
317
- }
318
-
319
- if (barStyle == UIBarStyleDefault) {
320
- return UIColor.whiteColor;
321
- }
322
-
323
- return UIColor.blackColor;
324
- }
325
-
326
- - (void)setTintColor:(UIColor *)tintColor {
327
- _tintColor = tintColor;
328
- _tintColorDarkContent = tintColor;
329
- _tintColorLightContent = tintColor;
330
- }
331
-
332
- - (UIColor *)tintColor {
333
- return [self tintColorWithBarStyle:_barStyle];
334
- }
335
-
336
- - (UIColor *)tintColorWithBarStyle:(UIBarStyle)barStyle {
337
- if (barStyle == UIBarStyleDefault && _tintColorDarkContent) {
338
- return _tintColorDarkContent;
339
- }
340
-
341
- if (barStyle != UIBarStyleDefault && _tintColorLightContent) {
342
- return _tintColorLightContent;
343
- }
344
-
345
- if (_tintColor) {
346
- return _tintColor;
347
- }
348
-
349
- if (barStyle == UIBarStyleDefault) {
350
- return UIColor.blackColor;
351
- }
352
-
353
- return UIColor.whiteColor;
354
- }
355
-
356
- - (void)setTitleTextColor:(UIColor *)titleTextColor {
357
- _titleTextColor = titleTextColor;
358
- _titleTextColorDarkContent = titleTextColor;
359
- _titleTextColorLightContent = titleTextColor;
360
- }
361
-
362
- - (UIColor *)titleTextColor {
363
- return [self titleTextColorWithBarStyle:_barStyle];
364
- }
365
-
366
- - (UIColor *)titleTextColorWithBarStyle:(UIBarStyle)barStyle {
367
- if (barStyle == UIBarStyleDefault && _titleTextColorDarkContent) {
368
- return _titleTextColorDarkContent;
369
- }
370
-
371
- if (barStyle != UIBarStyleDefault && _titleTextColorLightContent) {
372
- return _titleTextColorLightContent;
373
- }
374
-
375
- if (_titleTextColor) {
376
- return _titleTextColor;
377
- }
378
-
379
- if (barStyle == UIBarStyleDefault) {
380
- return UIColor.blackColor;
381
- }
382
-
383
- return UIColor.whiteColor;
384
122
  }
385
123
 
386
124
  @end
package/ios/HBDUtils.h CHANGED
@@ -8,14 +8,6 @@ UIKIT_STATIC_INLINE BOOL colorHasAlphaComponent(UIColor *color) {
8
8
  return CGColorGetAlpha(color.CGColor) < 1.0;
9
9
  }
10
10
 
11
- UIKIT_STATIC_INLINE BOOL imageHasAlphaChannel(UIImage *image) {
12
- CGImageAlphaInfo alpha = CGImageGetAlphaInfo(image.CGImage);
13
- return (alpha == kCGImageAlphaFirst ||
14
- alpha == kCGImageAlphaLast ||
15
- alpha == kCGImageAlphaPremultipliedFirst ||
16
- alpha == kCGImageAlphaPremultipliedLast);
17
- }
18
-
19
11
  UIKIT_STATIC_INLINE void hbd_exchangeImplementations(Class clazz, SEL originalSelector, SEL swizzledSelector) {
20
12
  Method originalMethod = class_getInstanceMethod(clazz, originalSelector);
21
13
  Method swizzledMethod = class_getInstanceMethod(clazz, swizzledSelector);
@@ -34,16 +26,10 @@ UIKIT_STATIC_INLINE void hbd_exchangeImplementations(Class clazz, SEL originalSe
34
26
 
35
27
  + (UIColor *)colorWithHexString:(NSString *)hexString;
36
28
 
37
- + (NSString *)hexStringFromColor:(UIColor *)color;
38
-
39
29
  + (UIImage *)UIImage:(NSDictionary *)json;
40
30
 
41
31
  + (UIImage *)imageWithColor:(UIColor *)color;
42
32
 
43
- + (NSString *)iconUriFromUri:(NSString *)uri;
44
-
45
33
  + (BOOL)isIphoneX;
46
34
 
47
- + (void)printViewHierarchy:(UIView *)view withPrefix:(NSString *)prefix;
48
-
49
35
  @end
package/ios/HBDUtils.mm CHANGED
@@ -2,32 +2,8 @@
2
2
 
3
3
  #import <React/RCTConvert.h>
4
4
 
5
- @implementation UIScrollView (HBDEdgeEffect)
6
-
7
- - (void)hbd_didMoveToWindow {
8
- [self hbd_didMoveToWindow];
9
-
10
- if (@available(iOS 26.0, *)) {
11
- self.topEdgeEffect.hidden = YES;
12
- self.leftEdgeEffect.hidden = YES;
13
- self.bottomEdgeEffect.hidden = YES;
14
- self.rightEdgeEffect.hidden = YES;
15
- }
16
- }
17
-
18
- @end
19
-
20
5
  @implementation HBDUtils
21
6
 
22
- + (void)load {
23
- if (@available(iOS 26.0, *)) {
24
- static dispatch_once_t onceToken;
25
- dispatch_once(&onceToken, ^{
26
- hbd_exchangeImplementations([UIScrollView class], @selector(didMoveToWindow), @selector(hbd_didMoveToWindow));
27
- });
28
- }
29
- }
30
-
31
7
  + (NSDictionary *)mergeItem:(NSDictionary *)item withTarget:(NSDictionary *)target {
32
8
  NSMutableDictionary *mutableTarget = [target mutableCopy];
33
9
  for (NSString *key in [item allKeys]) {
@@ -104,88 +80,7 @@
104
80
  }
105
81
 
106
82
  + (UIImage *)UIImage:(NSDictionary *)json {
107
- if ([json isKindOfClass:[NSDictionary class]]) {
108
- NSString *uri = json[@"uri"];
109
- if (uri && [uri hasPrefix:@"font:"]) {
110
- NSString *path = [self imagePathFromFontUri:uri];
111
- // RCTLogInfo(@"[Navigation] font path:%@", path);
112
- UIImage *image = [UIImage imageWithContentsOfFile:path];
113
- return image;
114
- } else {
115
- return [RCTConvert UIImage:json];
116
- }
117
- } else {
118
- return [RCTConvert UIImage:json];
119
- }
120
- }
121
-
122
- + (NSString *)iconUriFromUri:(NSString *)uri {
123
- if ([uri hasPrefix:@"font:"]) {
124
- return [self imagePathFromFontUri:uri];
125
- }
126
- return uri;
127
- }
128
-
129
- + (NSString *)imagePathFromFontUri:(NSString *)uri {
130
- uri = [uri substringFromIndex:7];
131
- // RCTLogInfo(@"[Navigation] font uri:%@", uri);
132
- NSArray *components = [uri componentsSeparatedByString:@"/"];
133
- if (components.count < 3) {
134
- return nil;
135
- }
136
- NSString *font = components[0];
137
- NSString *glyph = components[1];
138
- CGFloat size = [components[2] floatValue];
139
- UIColor *color = UIColor.whiteColor;
140
- if (components.count >= 4) {
141
- color = [self colorWithHexString:components[3]];
142
- }
143
- NSString *path = [self imagePathForFont:font withGlyph:glyph withFontSize:size withColor:color];
144
- return path;
145
- }
146
-
147
- + (NSString *)imagePathForFont:(NSString *)fontName withGlyph:(NSString *)glyph withFontSize:(CGFloat)fontSize withColor:(UIColor *)color {
148
- CGFloat screenScale = RCTScreenScale();
149
-
150
- NSString *hexColor = [self hexStringFromColor:color];
151
-
152
- NSString *fileName = [NSString stringWithFormat:@"tmp/RNVectorIcons_%@_%hu_%.f%@@%.fx.png", fontName, [glyph characterAtIndex:0], fontSize, hexColor, screenScale];
153
- NSString *filePath = [NSHomeDirectory() stringByAppendingPathComponent:fileName];
154
-
155
- if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
156
- // No cached icon exists, we need to create it and persist to disk
157
-
158
- UIFont *font = [UIFont fontWithName:fontName size:fontSize];
159
- NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:glyph attributes:@{NSFontAttributeName: font, NSForegroundColorAttributeName: color}];
160
-
161
- CGSize iconSize = [attributedString size];
162
- UIGraphicsBeginImageContextWithOptions(iconSize, NO, 0.0);
163
- [attributedString drawAtPoint:CGPointMake(0, 0)];
164
-
165
- UIImage *iconImage = UIGraphicsGetImageFromCurrentImageContext();
166
- UIGraphicsEndImageContext();
167
-
168
- NSData *imageData = UIImagePNGRepresentation(iconImage);
169
- BOOL success = [imageData writeToFile:filePath atomically:YES];
170
- if (!success) {
171
- RCTLogInfo(@"[Navigation] can't save %@", fileName);
172
- return nil;
173
- }
174
- }
175
- return filePath;
176
- }
177
-
178
- + (NSString *)hexStringFromColor:(UIColor *)color {
179
- const CGFloat *components = CGColorGetComponents(color.CGColor);
180
-
181
- CGFloat r = components[0];
182
- CGFloat g = components[1];
183
- CGFloat b = components[2];
184
-
185
- return [NSString stringWithFormat:@"#%02lX%02lX%02lX",
186
- lroundf(r * 255),
187
- lroundf(g * 255),
188
- lroundf(b * 255)];
83
+ return [RCTConvert UIImage:json];
189
84
  }
190
85
 
191
86
  + (BOOL)isIphoneX {
@@ -193,14 +88,4 @@
193
88
  return window.safeAreaInsets.bottom > 0.0;
194
89
  }
195
90
 
196
- + (void)printViewHierarchy:(UIView *)view withPrefix:(NSString *)prefix {
197
- NSString *viewName = [[[view classForCoder] description] stringByReplacingOccurrencesOfString:@"_" withString:@""];
198
- NSLog(@"%@%@ %@", prefix, viewName, NSStringFromCGRect(view.frame));
199
- if (view.subviews.count > 0) {
200
- for (UIView *sub in view.subviews) {
201
- [self printViewHierarchy:sub withPrefix:[NSString stringWithFormat:@"--%@", prefix]];
202
- }
203
- }
204
- }
205
-
206
91
  @end
@@ -1,12 +1,9 @@
1
1
  #ifndef HybridNavigation_h
2
2
  #define HybridNavigation_h
3
3
 
4
- #import "HBDBarButtonItem.h"
5
- #import "HBDNavigationBar.h"
6
4
  #import "HBDReactBridgeManager.h"
7
5
 
8
6
  #import "HBDViewController.h"
9
- #import "HBDViewController+Garden.h"
10
7
  #import "HBDNavigationController.h"
11
8
  #import "HBDTabBarController.h"
12
9
  #import "HBDDrawerController.h"
@@ -101,6 +101,14 @@
101
101
  }];
102
102
  }
103
103
 
104
+ - (UIViewController *)modalHostViewControllerForViewController:(UIViewController *)vc {
105
+ UIViewController *host = vc;
106
+ while (host.parentViewController != nil) {
107
+ host = host.parentViewController;
108
+ }
109
+ return host;
110
+ }
111
+
104
112
  - (void)handleDismissWithViewController:(UIViewController *) vc callback:(RCTResponseSenderBlock)callback {
105
113
  BOOL animated = YES;
106
114
  if ([vc isKindOfClass:[HBDViewController class]]) {
@@ -108,11 +116,11 @@
108
116
  animated = hbdvc.animatedTransition;
109
117
  }
110
118
 
111
- BOOL isOverFullScreen = vc.modalPresentationStyle == UIModalPresentationOverFullScreen;
112
- UIViewController *presenting = vc.presentingViewController;
119
+ UIViewController *modalHost = [self modalHostViewControllerForViewController:vc];
120
+ UIViewController *presenting = modalHost.presentingViewController;
113
121
 
114
- [vc dismissViewControllerAnimated:animated completion:^{
115
- if (isOverFullScreen && presenting != nil) {
122
+ [modalHost dismissViewControllerAnimated:animated completion:^{
123
+ if (presenting != nil) {
116
124
  HBDViewController *hbdvc = [[HBDReactBridgeManager get] primaryViewControllerWithViewController:presenting];
117
125
  if (hbdvc != nil) {
118
126
  [hbdvc adjustScreenOrientation];