hybrid-navigation 2.7.7 → 2.7.8

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 CHANGED
@@ -1,3 +1,15 @@
1
+ ## 2.7.8 (2022-03-03)
2
+
3
+ ### ios specific
4
+
5
+ - 修复因 NSUInteger 导致的问题
6
+
7
+ ```objc
8
+ for (NSUInteger i = count - 1; i > -1; i--) {
9
+ // 无法进入此区间
10
+ }
11
+ ```
12
+
1
13
  ## 2.7.7 (2022-03-03)
2
14
 
3
15
  ### Android specific
@@ -182,13 +182,12 @@ RCT_EXPORT_METHOD(findSceneIdByModuleName:
182
182
 
183
183
  UIApplication *application = [[UIApplication class] performSelector:@selector(sharedApplication)];
184
184
  NSString *sceneId = nil;
185
- NSUInteger index = application.windows.count - 1;
186
-
187
185
  NSString *moduleName = params[@"moduleName"];
188
186
  Promise *promise = params[@"promise"];
189
187
 
190
- while (index > -1 && sceneId == nil) {
191
- UIWindow *window = application.windows[index];
188
+ NSUInteger index = application.windows.count;
189
+ while (index > 0 && sceneId == nil) {
190
+ UIWindow *window = application.windows[index - 1];
192
191
  sceneId = [self findSceneIdByModuleName:moduleName withViewController:window.rootViewController];
193
192
  index--;
194
193
  }
@@ -216,9 +215,9 @@ RCT_EXPORT_METHOD(findSceneIdByModuleName:
216
215
  NSArray<UIViewController *> *children = vc.childViewControllers;
217
216
  NSUInteger count = children.count;
218
217
  if (count > 0) {
219
- NSUInteger index = count - 1;
220
- while (index > -1 && sceneId == nil) {
221
- UIViewController *child = children[index];
218
+ NSUInteger index = count;
219
+ while (index > 0 && sceneId == nil) {
220
+ UIViewController *child = children[index - 1];
222
221
  sceneId = [self findSceneIdByModuleName:moduleName withViewController:child];
223
222
  index--;
224
223
  }
@@ -98,12 +98,13 @@
98
98
  NSUInteger count = children.count;
99
99
  NSString *moduleName = extras[@"moduleName"];
100
100
  BOOL inclusive = [extras[@"inclusive"] boolValue];
101
- for (NSUInteger i = count - 1; i > -1; i--) {
102
- HBDViewController *vc = children[i];
101
+ for (NSUInteger i = count; i > 0; i--) {
102
+ NSUInteger index = i - 1;
103
+ HBDViewController *vc = children[index];
103
104
  if ([moduleName isEqualToString:vc.moduleName] || [moduleName isEqualToString:vc.sceneId]) {
104
105
  viewController = vc;
105
- if (inclusive && i - 1 > -1) {
106
- viewController = children[i - 1];
106
+ if (inclusive && i > 0) {
107
+ viewController = children[index];
107
108
  }
108
109
  break;
109
110
  }
@@ -105,8 +105,9 @@
105
105
 
106
106
  - (void)removeTabBarAboriginal {
107
107
  NSUInteger count = self.tabBar.subviews.count;
108
- for (NSInteger i = count - 1; i > -1; i--) {
109
- UIView *view = self.tabBar.subviews[i];
108
+ for (NSUInteger i = count; i > 0; i--) {
109
+ NSUInteger index = i - 1;
110
+ UIView *view = self.tabBar.subviews[index];
110
111
  NSString *viewName = [[[view classForCoder] description] stringByReplacingOccurrencesOfString:@"_" withString:@""];
111
112
  if ([viewName isEqualToString:@"UITabBarButton"]) {
112
113
  [view removeFromSuperview];
@@ -17,9 +17,10 @@
17
17
  - (void)redirectToViewController:(UIViewController *)controller target:(UIViewController *)target animated:(BOOL)animated {
18
18
  NSMutableArray *children = [self.childViewControllers mutableCopy];
19
19
  NSUInteger count = self.childViewControllers.count;
20
- for (NSUInteger i = count - 1; i > -1; i--) {
21
- UIViewController *child = children[i];
22
- [children removeObjectAtIndex:i];
20
+ for (NSUInteger i = count; i > 0; i--) {
21
+ NSUInteger index = i - 1;
22
+ UIViewController *child = children[index];
23
+ [children removeObjectAtIndex:index];
23
24
  if (child == target) {
24
25
  break;
25
26
  }
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": "2.7.7",
4
+ "version": "2.7.8",
5
5
  "keywords": [
6
6
  "react-native",
7
7
  "navigation",