@@ -117,8 +117,46 @@ - (void)testBackgroundColor_validColor {
117117- (void )testTabBarBackgroundColor {
118118 UIColor *tabBarBackgroundColor = [UIColor redColor ];
119119 [self .uut setTabBarBackgroundColor: tabBarBackgroundColor];
120- XCTAssertTrue ([self .children.lastObject.tabBarItem.standardAppearance.backgroundColor
121- isEqual: tabBarBackgroundColor]);
120+ XCTAssertTrue (
121+ [((UITabBarController *)self .boundViewController).tabBar.standardAppearance.backgroundColor
122+ isEqual: tabBarBackgroundColor]);
123+ }
124+
125+ - (void )testSetTabBarBackgroundColor_shouldPreserveBottomTabTitleColors {
126+ RNNNavigationOptions *options = [RNNNavigationOptions emptyOptions ];
127+ options.bottomTab = [[RNNBottomTabOptions alloc ] initWithDict: @{
128+ @" text" : @" Home" ,
129+ @" textColor" : @(0xFFFF0000 ),
130+ @" selectedTextColor" : @(0xFF00FF00 )
131+ }];
132+
133+ BottomTabPresenter *bottomTabPresenter =
134+ [BottomTabPresenterCreator createWithDefaultOptions: nil ];
135+ UIViewController *child = self.children .lastObject ;
136+ [bottomTabPresenter applyOptions: options child: child];
137+
138+ [self .uut setTabBarBackgroundColor: UIColor.blueColor];
139+
140+ UIColor *normalColor = child.tabBarItem .standardAppearance .stackedLayoutAppearance .normal
141+ .titleTextAttributes [NSForegroundColorAttributeName ];
142+ UIColor *selectedColor = child.tabBarItem .standardAppearance .stackedLayoutAppearance .selected
143+ .titleTextAttributes [NSForegroundColorAttributeName ];
144+
145+ XCTAssertTrue ([normalColor isEqual: UIColor.redColor]);
146+ XCTAssertTrue ([selectedColor isEqual: UIColor.greenColor]);
147+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000
148+ if (@available (iOS 15.0 , *)) {
149+ UIColor *scrollEdgeNormalColor =
150+ child.tabBarItem .scrollEdgeAppearance .stackedLayoutAppearance .normal
151+ .titleTextAttributes [NSForegroundColorAttributeName ];
152+ UIColor *scrollEdgeSelectedColor =
153+ child.tabBarItem .scrollEdgeAppearance .stackedLayoutAppearance .selected
154+ .titleTextAttributes [NSForegroundColorAttributeName ];
155+
156+ XCTAssertTrue ([scrollEdgeNormalColor isEqual: UIColor.redColor]);
157+ XCTAssertTrue ([scrollEdgeSelectedColor isEqual: UIColor.greenColor]);
158+ }
159+ #endif
122160}
123161
124162- (void )testApplyOptions_applyTabBarShadowDefaultValues {
0 commit comments