Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions ios/BottomTabsAppearancePresenter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,6 @@ - (void)applyTabBarAppearance:(UITabBarAppearance *)appearance {
self.tabBar.scrollEdgeAppearance = [appearance copy];
}
#endif

for (UIViewController *childViewController in self.tabBarController.childViewControllers) {
childViewController.tabBarItem.standardAppearance = [appearance copy];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000
if (@available(iOS 15.0, *)) {
childViewController.tabBarItem.scrollEdgeAppearance = [appearance copy];
}
#endif
}
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,46 @@ - (void)testBackgroundColor_validColor {
- (void)testTabBarBackgroundColor {
UIColor *tabBarBackgroundColor = [UIColor redColor];
[self.uut setTabBarBackgroundColor:tabBarBackgroundColor];
XCTAssertTrue([self.children.lastObject.tabBarItem.standardAppearance.backgroundColor
isEqual:tabBarBackgroundColor]);
XCTAssertTrue(
[((UITabBarController *)self.boundViewController).tabBar.standardAppearance.backgroundColor
isEqual:tabBarBackgroundColor]);
}

- (void)testSetTabBarBackgroundColor_shouldPreserveBottomTabTitleColors {
RNNNavigationOptions *options = [RNNNavigationOptions emptyOptions];
options.bottomTab = [[RNNBottomTabOptions alloc] initWithDict:@{
@"text" : @"Home",
@"textColor" : @(0xFFFF0000),
@"selectedTextColor" : @(0xFF00FF00)
}];

BottomTabPresenter *bottomTabPresenter =
[BottomTabPresenterCreator createWithDefaultOptions:nil];
UIViewController *child = self.children.lastObject;
[bottomTabPresenter applyOptions:options child:child];

[self.uut setTabBarBackgroundColor:UIColor.blueColor];

UIColor *normalColor = child.tabBarItem.standardAppearance.stackedLayoutAppearance.normal
.titleTextAttributes[NSForegroundColorAttributeName];
UIColor *selectedColor = child.tabBarItem.standardAppearance.stackedLayoutAppearance.selected
.titleTextAttributes[NSForegroundColorAttributeName];

XCTAssertTrue([normalColor isEqual:UIColor.redColor]);
XCTAssertTrue([selectedColor isEqual:UIColor.greenColor]);
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000
if (@available(iOS 15.0, *)) {
UIColor *scrollEdgeNormalColor =
child.tabBarItem.scrollEdgeAppearance.stackedLayoutAppearance.normal
.titleTextAttributes[NSForegroundColorAttributeName];
UIColor *scrollEdgeSelectedColor =
child.tabBarItem.scrollEdgeAppearance.stackedLayoutAppearance.selected
.titleTextAttributes[NSForegroundColorAttributeName];

XCTAssertTrue([scrollEdgeNormalColor isEqual:UIColor.redColor]);
XCTAssertTrue([scrollEdgeSelectedColor isEqual:UIColor.greenColor]);
}
#endif
}

- (void)testApplyOptions_applyTabBarShadowDefaultValues {
Expand Down
Loading