react-native-navigation 8.7.6 → 8.7.7

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.
@@ -62,13 +62,52 @@ const NSInteger BLUR_TOPBAR_TAG = 78264802;
62
62
  self.navigationBar.clipsToBounds = clipsToBounds;
63
63
  }
64
64
 
65
- - (void)setBackButtonTestID:(NSString *)testID {
66
- UIView *navigationBarContentView =
65
+ - (UIView *)rnn_findBackButtonView {
66
+ UIView *contentView =
67
67
  [self.navigationBar findChildByClass:NSClassFromString(@"_UINavigationBarContentView")];
68
- UIView *barButton =
69
- [navigationBarContentView findChildByClass:NSClassFromString(@"_UIButtonBarButton")];
70
- if (barButton)
71
- barButton.accessibilityIdentifier = testID;
68
+ if (!contentView) {
69
+ contentView =
70
+ [self.navigationBar findChildByClass:NSClassFromString(@"UIKit.NavigationBarContentView")];
71
+ }
72
+ if (!contentView)
73
+ return nil;
74
+
75
+ Class buttonClass = NSClassFromString(@"_UIButtonBarButton");
76
+
77
+ return [contentView findDescendantByClass:buttonClass
78
+ passingTest:^BOOL(UIView *view) {
79
+ if ([view respondsToSelector:NSSelectorFromString(@"isBackButton")]) {
80
+ return [[view valueForKey:@"backButton"] boolValue];
81
+ }
82
+ return YES;
83
+ }];
84
+ }
85
+
86
+ - (void)rnn_applyTestID:(NSString *)testID toBackButtonView:(UIView *)barButton {
87
+ barButton.accessibilityIdentifier = testID;
88
+ barButton.isAccessibilityElement = YES;
89
+ }
90
+
91
+ - (void)setBackButtonTestID:(NSString *)testID {
92
+ if (!testID)
93
+ return;
94
+
95
+ UIView *barButton = [self rnn_findBackButtonView];
96
+ if (barButton) {
97
+ [self rnn_applyTestID:testID toBackButtonView:barButton];
98
+ } else {
99
+ __weak UINavigationController *weakSelf = self;
100
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)),
101
+ dispatch_get_main_queue(), ^{
102
+ UINavigationController *nc = weakSelf;
103
+ if (!nc)
104
+ return;
105
+ UIView *btn = [nc rnn_findBackButtonView];
106
+ if (btn) {
107
+ [nc rnn_applyTestID:testID toBackButtonView:btn];
108
+ }
109
+ });
110
+ }
72
111
  }
73
112
 
74
113
  - (CGFloat)getTopBarHeight {
@@ -12,6 +12,10 @@ typedef NS_ENUM(NSInteger, ViewType) {
12
12
 
13
13
  - (UIView *)findChildByClass:clazz;
14
14
 
15
+ - (UIView *)findDescendantByClass:clazz;
16
+
17
+ - (UIView *)findDescendantByClass:(Class)clazz passingTest:(BOOL (^)(UIView *view))test;
18
+
15
19
  - (ViewType)viewType;
16
20
 
17
21
  - (void)stopMomentumScrollViews;
@@ -18,6 +18,28 @@
18
18
  return nil;
19
19
  }
20
20
 
21
+ - (UIView *)findDescendantByClass:(id)clazz {
22
+ for (UIView *child in [self subviews]) {
23
+ if ([child isKindOfClass:clazz])
24
+ return child;
25
+ UIView *found = [child findDescendantByClass:clazz];
26
+ if (found)
27
+ return found;
28
+ }
29
+ return nil;
30
+ }
31
+
32
+ - (UIView *)findDescendantByClass:(Class)clazz passingTest:(BOOL (^)(UIView *view))test {
33
+ for (UIView *child in [self subviews]) {
34
+ if ([child isKindOfClass:clazz] && test(child))
35
+ return child;
36
+ UIView *found = [child findDescendantByClass:clazz passingTest:test];
37
+ if (found)
38
+ return found;
39
+ }
40
+ return nil;
41
+ }
42
+
21
43
  - (ViewType)viewType {
22
44
  #ifdef RCT_NEW_ARCH_ENABLED
23
45
  if ([self isKindOfClass:[RCTImageComponentView class]]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-navigation",
3
- "version": "8.7.6",
3
+ "version": "8.7.7",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android",
5
5
  "license": "MIT",
6
6
  "nativePackage": true,
@@ -124,7 +124,6 @@
124
124
  "eslint-plugin-jest": "^28.11.0",
125
125
  "eslint-plugin-prettier": "3.1.4",
126
126
  "github-release-notes": "https://github.com/yogevbd/github-release-notes/tarball/e601b3dba72dcd6cba323c1286ea6dd0c0110b58",
127
- "husky": "4.2.5",
128
127
  "identity-obj-proxy": "3.0.0",
129
128
  "jest": "^29.6.3",
130
129
  "lint-staged": "10.2.11",
@@ -152,11 +151,6 @@
152
151
  "playground"
153
152
  ],
154
153
  "packageManager": "yarn@4.12.0",
155
- "husky": {
156
- "hooks": {
157
- "pre-commit": "lint-staged"
158
- }
159
- },
160
154
  "lint-staged": {
161
155
  "*.{js,ts,tsx}": "eslint --fix",
162
156
  "*.{h,m,mm}": "node ./scripts/check-clang-format",