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
1 change: 1 addition & 0 deletions iphone/Classes/TiUITabProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
BOOL hasFocus;
BOOL iconOriginal;
BOOL activeIconOriginal;
UITraitCollection *lastTabBarTraitCollection;

id<TiOrientationController> parentOrientationController;

Expand Down
31 changes: 31 additions & 0 deletions iphone/Classes/TiUITabProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ - (void)_destroy
RELEASE_TO_NIL(rootWindow);
RELEASE_TO_NIL(controller);
RELEASE_TO_NIL(current);
RELEASE_TO_NIL(lastTabBarTraitCollection);
RELEASE_TO_NIL(fullWidthBackGestureRecognizer);

[super _destroy];
Expand Down Expand Up @@ -79,6 +80,23 @@ - (void)_configure

- (void)didChangeTraitCollection:(NSNotification *)info
{
UITraitCollection *currentTraitCollection = controller.traitCollection;

if (currentTraitCollection == nil) {
currentTraitCollection = rootWindow.hostingController.traitCollection;
}

if (currentTraitCollection == nil) {
return;
}

if ((lastTabBarTraitCollection != nil)
&& ![currentTraitCollection hasDifferentColorAppearanceComparedToTraitCollection:lastTabBarTraitCollection]
&& (currentTraitCollection.horizontalSizeClass == lastTabBarTraitCollection.horizontalSizeClass)
&& (currentTraitCollection.verticalSizeClass == lastTabBarTraitCollection.verticalSizeClass)) {
return;
}
Comment on lines +83 to +98
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason behind the trait collection check? If it's different, the underlaying issue should be in the presented modal state, not the return state.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prashantsaini1 Think you'll have to check that as that one was generated from your AI

Copy link
Copy Markdown
Contributor

@prashantsaini1 prashantsaini1 Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The didChangeTraitCollection is triggered only for ≥ 26, not below this version. It seems something must have changed internally in how the iOS handles it now for different classes (so we only compare it for horizontal + vertical sizes and color appearances for system dark/light modes).


[self updateTabBarItem];
}

Expand Down Expand Up @@ -558,6 +576,10 @@ - (void)updateTabBarItem
ENSURE_UI_THREAD_0_ARGS;

UIViewController *rootController = [rootWindow hostingController];
UITraitCollection *currentTraitCollection = controller.traitCollection;
if (currentTraitCollection == nil) {
currentTraitCollection = rootController.traitCollection;
}
id badgeValue = [TiUtils stringValue:[self valueForKey:@"badge"]];
id badgeColor = [self valueForKey:@"badgeColor"];
id iconInsets = [self valueForKey:@"iconInsets"];
Expand All @@ -581,6 +603,10 @@ - (void)updateTabBarItem
[newItem release];

systemTab = YES;
if (currentTraitCollection != lastTabBarTraitCollection) {
[lastTabBarTraitCollection release];
lastTabBarTraitCollection = [currentTraitCollection retain];
}
return;
}

Expand Down Expand Up @@ -707,6 +733,11 @@ - (void)updateTabBarItem
[tabBarItem setBadgeValue:badgeValue];

systemTab = NO;

if (currentTraitCollection != lastTabBarTraitCollection) {
[lastTabBarTraitCollection release];
lastTabBarTraitCollection = [currentTraitCollection retain];
}
}

- (UIEdgeInsets)calculateIconInsets:(id)value
Expand Down
Loading