react-native-navigation 8.8.11 → 8.9.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.
@@ -3,12 +3,30 @@
3
3
  #import "RNNConvert.h"
4
4
  #import "UIImage+utils.h"
5
5
 
6
- @implementation BottomTabsBasePresenter
6
+ @implementation BottomTabsBasePresenter {
7
+ BOOL _didApplyInitialTabBarVisibility;
8
+ }
9
+
10
+ - (BOOL)tabBarVisibilityAnimation:(BOOL)animated {
11
+ if (@available(iOS 18.0, *)) {
12
+ return animated;
13
+ }
14
+ if (_didApplyInitialTabBarVisibility) {
15
+ return animated;
16
+ }
17
+
18
+ _didApplyInitialTabBarVisibility = YES;
19
+ return NO;
20
+ }
7
21
 
8
22
  - (void)applyOptionsOnInit:(RNNNavigationOptions *)options {
9
23
  [super applyOptionsOnInit:options];
10
- UITabBarController *bottomTabs = self.tabBarController;
24
+ RNNBottomTabsController *bottomTabs = self.tabBarController;
11
25
  RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
26
+ if (@available(iOS 18.0, *)) {
27
+ [bottomTabs setTabBarVisible:[withDefault.bottomTabs.visible withDefault:YES]
28
+ animated:NO];
29
+ }
12
30
  [bottomTabs setCurrentTabIndex:[withDefault.bottomTabs.currentTabIndex withDefault:0]];
13
31
  if (withDefault.bottomTabs.currentTabId.hasValue) {
14
32
  [bottomTabs setCurrentTabID:withDefault.bottomTabs.currentTabId.get];
@@ -24,7 +42,9 @@
24
42
  RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
25
43
 
26
44
  [bottomTabs setTabBarTestID:[withDefault.bottomTabs.testID withDefault:nil]];
27
- [bottomTabs setTabBarVisible:[withDefault.bottomTabs.visible withDefault:YES]];
45
+ [bottomTabs reconcileTabBarVisible:[withDefault.bottomTabs.visible withDefault:YES]
46
+ animated:[self tabBarVisibilityAnimation:
47
+ [withDefault.bottomTabs.animate withDefault:YES]]];
28
48
 
29
49
  [bottomTabs.view setBackgroundColor:[withDefault.layout.backgroundColor withDefault:nil]];
30
50
  [bottomTabs setTabBarHideShadow:[withDefault.bottomTabs.hideShadow withDefault:NO]];
@@ -74,12 +94,8 @@
74
94
  }
75
95
 
76
96
  if (mergeOptions.bottomTabs.visible.hasValue) {
77
- if (mergeOptions.bottomTabs.animate.hasValue) {
78
- [bottomTabs setTabBarVisible:mergeOptions.bottomTabs.visible.get
79
- animated:[mergeOptions.bottomTabs.animate withDefault:NO]];
80
- } else {
81
- [bottomTabs setTabBarVisible:mergeOptions.bottomTabs.visible.get animated:NO];
82
- }
97
+ [bottomTabs setTabBarVisible:mergeOptions.bottomTabs.visible.get
98
+ animated:[withDefault.bottomTabs.animate withDefault:YES]];
83
99
  }
84
100
 
85
101
  if (mergeOptions.layout.backgroundColor.hasValue) {
@@ -28,6 +28,8 @@
28
28
 
29
29
  - (void)setTabBarVisible:(BOOL)visible;
30
30
 
31
+ - (void)reconcileTabBarVisible:(BOOL)visible animated:(BOOL)animated;
32
+
31
33
  - (void)handleTabBarLongPress:(CGPoint)locationInTabBar;
32
34
 
33
35
  @end
@@ -290,7 +290,7 @@
290
290
  tabBarInView.size.width, desiredHeight);
291
291
 
292
292
  _customRow.frame = rowFrame;
293
- _customRow.hidden = self.tabBar.hidden;
293
+ _customRow.hidden = [self rnn_isTabBarHidden];
294
294
  [_customRow setSelectedIndex:_currentTabIndex];
295
295
  }
296
296
 
@@ -414,8 +414,21 @@
414
414
  }
415
415
 
416
416
  - (void)setTabBarVisible:(BOOL)visible {
417
+ [self reconcileTabBarVisible:visible animated:NO];
418
+ }
419
+
420
+ - (void)reconcileTabBarVisible:(BOOL)visible animated:(BOOL)animated {
421
+ if (@available(iOS 18.0, *)) {
422
+ BOOL shouldHide = !visible;
423
+ if (self.tabBarHidden != shouldHide) {
424
+ [self setTabBarVisible:visible animated:animated];
425
+ }
426
+ _tabBarNeedsRestore = NO;
427
+ return;
428
+ }
429
+
417
430
  if (_tabBarNeedsRestore || !self.presentedComponentViewController.navigationController) {
418
- [self setTabBarVisible:visible animated:NO];
431
+ [self setTabBarVisible:visible animated:animated];
419
432
  _tabBarNeedsRestore = NO;
420
433
  }
421
434
  }
@@ -1,5 +1,6 @@
1
1
  #import "RNNComponentViewController.h"
2
2
  #import "AnimationObserver.h"
3
+ #import "UITabBarController+RNNOptions.h"
3
4
 
4
5
  @implementation RNNComponentViewController {
5
6
  NSArray *_reactViewConstraints;
@@ -126,7 +127,7 @@
126
127
  }
127
128
 
128
129
  - (BOOL)shouldDrawBehindBottomTabs {
129
- return !self.tabBarController.tabBar || self.tabBarController.tabBar.isHidden ||
130
+ return !self.tabBarController.tabBar || [self.tabBarController rnn_isTabBarHidden] ||
130
131
  _drawBehindBottomTabs;
131
132
  }
132
133
 
@@ -20,6 +20,8 @@
20
20
 
21
21
  - (void)hideTabBar:(BOOL)animated;
22
22
 
23
+ - (BOOL)rnn_isTabBarHidden;
24
+
23
25
  - (void)syncTabBarItemTestIDs;
24
26
 
25
27
  @end
@@ -141,6 +141,11 @@ static const void *RNNOriginalTabBarViewAccessibilityIdentifierKey =
141
141
  }
142
142
 
143
143
  - (void)showTabBar:(BOOL)animated {
144
+ if (@available(iOS 18.0, *)) {
145
+ [self setTabBarHidden:NO animated:animated];
146
+ return;
147
+ }
148
+
144
149
  static const CGFloat animationDuration = 0.15;
145
150
  const CGRect tabBarVisibleFrame = CGRectMake(
146
151
  self.tabBar.frame.origin.x, self.view.frame.size.height - self.tabBar.frame.size.height,
@@ -161,6 +166,11 @@ static const void *RNNOriginalTabBarViewAccessibilityIdentifierKey =
161
166
  }
162
167
 
163
168
  - (void)hideTabBar:(BOOL)animated {
169
+ if (@available(iOS 18.0, *)) {
170
+ [self setTabBarHidden:YES animated:animated];
171
+ return;
172
+ }
173
+
164
174
  static const CGFloat animationDuration = 0.15;
165
175
  const CGRect tabBarHiddenFrame =
166
176
  CGRectMake(self.tabBar.frame.origin.x, self.view.frame.size.height,
@@ -182,6 +192,14 @@ static const void *RNNOriginalTabBarViewAccessibilityIdentifierKey =
182
192
  }
183
193
  }
184
194
 
195
+ - (BOOL)rnn_isTabBarHidden {
196
+ if (@available(iOS 18.0, *)) {
197
+ return self.tabBarHidden;
198
+ }
199
+
200
+ return self.tabBar.hidden;
201
+ }
202
+
185
203
  - (void)forEachTab:(void (^)(UIView *, UIViewController *tabViewController,
186
204
  int tabIndex))performOnTab {
187
205
  int tabIndex = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-navigation",
3
- "version": "8.8.11",
3
+ "version": "8.9.0",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android",
5
5
  "license": "MIT",
6
6
  "nativePackage": true,
@@ -183,4 +183,4 @@
183
183
  ]
184
184
  ]
185
185
  }
186
- }
186
+ }