You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Android, when removing or adding a tab, the badges are on the wrong tabs.
It seems it is only with bottom tab placement.
I have recreated this issue with the sample app on Samsung Galaxy S8 running Android 8.0.0:
Select "Use bottom tab placement"
Press ex. "Tabbed page root with children as navigation pages".
Press "Remove tab".
Before pressing remove tab:
After pressing remove tab:
Pressing "Add tab" instead of "Remove tab":
The text was updated successfully, but these errors were encountered:
I'm experiencing a similar behavior with top tabs on android using the BadgedTabbedPageRenderer.
I think this issue is best described as the badges staying on the original tab index after tab pages are add/removed at runtime.
Setting up a simple example where tabs can be added and removed at either the left or right at runtime reproduces this issue.
Adding tabs to the left
Add 2 tabs to the left:
Observed behavior
The badges were on page 1, 2, and 4 (tab indices 0, 1, and 3) before adding new pages, but after adding pages the badges are on page L2, L1, and 2 (tab indices 0, 1, and 3).
Expected behavior
The badges are on page 1, 2, and 4 (new tab indices 2, 3, and 5)
Removing and adding tabs to the right
Remove 2 tabs on the right:
Add 1 tab on the right:
Observed behavior
The badges were on pages 1, 2, and 4 (tab indices 0, 1, and 3) before removing pages and adding new pages, but after they were on pages 1, 2, and R1 (tab indices 0, 1, and 3)
Expected behavior
The badges are on page 1 and 2 (page 4 was removed)
I'd like to help with fixing this bug, but I'm struggling a bit. It seems we should try to "refresh" all of the tab view's badge views. To do this I've tried a few approaches, most notable are the following.
Iterating over the BadgeViews collection and calling UpdateFromElement on the view using the page whenever tabs are added or removed (OnTabAdded, OnTabRemoved), but it doesn't seem to do anything.
foreach (var (element, badgeView) in BadgeViews)
{
badgeView.UpdateFromElement((Page)element);
}
Calling AddTabBadge for all of the pages. AddTabBadge refreshes the badge if one already exists and creates a new one if it doesn't. This fixed the "Adding tabs to the left" case above, but not the "Removing and adding tabs to the right" case.
for (var i = 0; i < Element.Children.Count; i++)
{
AddTabBadge(i);
}
These attempts did not seem to affect the bottom tab behavior.
On Android, when removing or adding a tab, the badges are on the wrong tabs.
It seems it is only with bottom tab placement.
I have recreated this issue with the sample app on Samsung Galaxy S8 running Android 8.0.0:
Before pressing remove tab:
After pressing remove tab:
Pressing "Add tab" instead of "Remove tab":
The text was updated successfully, but these errors were encountered: