Bladeren bron

added testID support in topBar and bottomTabs (#2334)

yogevbd 7 jaren geleden
bovenliggende
commit
bfdf2cd892

+ 9
- 1
lib/ios/RNNNavigationOptions.m Bestand weergeven

@@ -48,7 +48,7 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
48 48
 
49 49
 -(void)applyOn:(UIViewController*)viewController {
50 50
 	if (self.topBar) {
51
-		if(self.topBar.backgroundColor) {
51
+		if (self.topBar.backgroundColor) {
52 52
 			UIColor* backgroundColor = [RCTConvert UIColor:self.topBar.backgroundColor];
53 53
 			viewController.navigationController.navigationBar.barTintColor = backgroundColor;
54 54
 		} else {
@@ -169,6 +169,10 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
169 169
 				.shadowImage = nil;
170 170
 			}
171 171
 		}
172
+		
173
+		if (self.topBar.testID) {
174
+			viewController.navigationController.navigationBar.accessibilityIdentifier = self.topBar.testID;
175
+		}
172 176
 	}
173 177
 	
174 178
 	if (self.popGesture) {
@@ -195,6 +199,10 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
195 199
 		if (self.bottomTabs.hidden) {
196 200
 			[((RNNTabBarController *)viewController.tabBarController) setTabBarHidden:[self.bottomTabs.hidden boolValue] animated:[self.bottomTabs.animateHide boolValue]];
197 201
 		}
202
+		
203
+		if (self.bottomTabs.testID) {
204
+			viewController.tabBarController.tabBar.accessibilityIdentifier = self.bottomTabs.testID;
205
+		}
198 206
 	}
199 207
 	
200 208
 	if (self.statusBarBlur) {

+ 1
- 0
lib/ios/RNNTabBarOptions.h Bestand weergeven

@@ -8,6 +8,7 @@ extern const NSInteger BLUR_TOPBAR_TAG;
8 8
 @property (nonatomic, strong) NSNumber* animateHide;
9 9
 @property (nonatomic, strong) NSString* tabBadge;
10 10
 @property (nonatomic, strong) NSNumber* currentTabIndex;
11
+@property (nonatomic, strong) NSString* testID;
11 12
 
12 13
 -(instancetype)init;
13 14
 -(instancetype)initWithDict:(NSDictionary *)topBarOptions;

+ 1
- 0
lib/ios/RNNTabBarOptions.m Bestand weergeven

@@ -13,6 +13,7 @@
13 13
 	self.animateHide = [tabBarOptions valueForKey:@"animateHide"];
14 14
 	self.tabBadge = [tabBarOptions valueForKey:@"tabBadge"];
15 15
 	self.currentTabIndex = [tabBarOptions valueForKey:@"currentTabIndex"];
16
+	self.testID = [tabBarOptions valueForKey:@"testID"];
16 17
 	
17 18
 	return self;
18 19
 }

+ 1
- 0
lib/ios/RNNTopBarOptions.h Bestand weergeven

@@ -18,6 +18,7 @@ extern const NSInteger BLUR_TOPBAR_TAG;
18 18
 @property (nonatomic, strong) NSNumber* blur;
19 19
 @property (nonatomic, strong) NSNumber* animateHide;
20 20
 @property (nonatomic, strong) NSNumber* largeTitle;
21
+@property (nonatomic, strong) NSString* testID;
21 22
 
22 23
 -(instancetype)init;
23 24
 -(instancetype)initWithDict:(NSDictionary *)topBarOptions;

+ 3
- 2
lib/ios/RNNTopBarOptions.m Bestand weergeven

@@ -21,8 +21,9 @@
21 21
 	self.translucent = [topBarOptions valueForKey:@"translucent"];
22 22
 	self.transparent = [topBarOptions valueForKey:@"transparent"];
23 23
 	self.noBorder = [topBarOptions valueForKey:@"noBorder"];
24
-	self.animateHide =[topBarOptions valueForKey:@"animateHide"];
25
-	self.largeTitle =[topBarOptions valueForKey:@"largeTitle"];
24
+	self.animateHide = [topBarOptions valueForKey:@"animateHide"];
25
+	self.largeTitle = [topBarOptions valueForKey:@"largeTitle"];
26
+	self.testID = [topBarOptions valueForKey:@"testID"];
26 27
 	
27 28
 	return self;
28 29
 }