diff --git a/React/Views/RCTTabBarItem.h b/React/Views/RCTTabBarItem.h index 19f7af36c..0f4350eae 100644 --- a/React/Views/RCTTabBarItem.h +++ b/React/Views/RCTTabBarItem.h @@ -28,6 +28,7 @@ @property (nonatomic, assign, getter=isSelected) BOOL selected; @property (nonatomic, readonly) UITabBarItem *barItem; @property (nonatomic, copy) RCTBubblingEventBlock onPress; +@property (nonatomic, strong) NSString *testID; #if TARGET_OS_TV @property (nonatomic, assign) BOOL wasSelectedInJS; diff --git a/React/Views/RCTTabBarItem.m b/React/Views/RCTTabBarItem.m index bfb1a531f..b48cb4d15 100644 --- a/React/Views/RCTTabBarItem.m +++ b/React/Views/RCTTabBarItem.m @@ -58,6 +58,11 @@ RCT_ENUM_CONVERTER(UITabBarSystemItem, (@{ return _barItem; } +- (void)setTestID:(NSString *)testID +{ + self.barItem.accessibilityIdentifier = testID; +} + - (void)setBadge:(id)badge { _badge = [badge copy]; diff --git a/React/Views/RCTTabBarItemManager.m b/React/Views/RCTTabBarItemManager.m index ece10d3bd..ca4684577 100644 --- a/React/Views/RCTTabBarItemManager.m +++ b/React/Views/RCTTabBarItemManager.m @@ -30,6 +30,7 @@ RCT_EXPORT_VIEW_PROPERTY(systemIcon, UITabBarSystemItem) RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock) RCT_EXPORT_VIEW_PROPERTY(badgeColor, UIColor) RCT_EXPORT_VIEW_PROPERTY(isTVSelectable, BOOL) +RCT_EXPORT_VIEW_PROPERTY(testID, NSString) RCT_CUSTOM_VIEW_PROPERTY(title, NSString, RCTTabBarItem) { view.barItem.title = json ? [RCTConvert NSString:json] : defaultView.barItem.title;