Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException when changing number of tabbar pages - fix #22589

Merged
merged 8 commits into from
May 29, 2024

Conversation

kubaflo
Copy link
Collaborator

@kubaflo kubaflo commented May 22, 2024

Issues Fixed

Fixes #18251

Before After
Screen.Recording.2024-05-23.at.01.08.51.mov
Screen.Recording.2024-05-23.at.01.07.26.mov

@kubaflo kubaflo requested a review from a team as a code owner May 22, 2024 23:58
Copy link
Contributor

Hey there @kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label May 22, 2024
@PureWeen
Copy link
Member

PureWeen commented May 23, 2024

/azp run

This comment was marked as outdated.

{
menu.RemoveItem(menu.GetItem(menu.Size() - 1).ItemId);
}
menu.Clear();
Copy link
Member

Choose a reason for hiding this comment

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

Need to verify this change against
16a3972#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5R75-R80

Where I originally modified this.

Make sure the issue fixed by that PR doesn't resurface here

Copy link
Member

Choose a reason for hiding this comment

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

I think the idea is that we don't want to completely clear the menu and then re-add because then it causes a shuffling to happen visually
So, the point of walking backwards was to just sync the list, instead of just clear and re-add
I think will still need the old code but a variation of it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@PureWeen I've added a commit. Let me know what you think

Copy link
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

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

Seem to be some tests failing although it seems like a detail with whitespace or something

Assert.Equal() Failure: Values differ\nExpected: Tab 1\nActual: Tab 1

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jfversluis jfversluis added platform/android 🤖 area-controls-shell Shell Navigation, Routes, Tabs, Flyout labels May 23, 2024
@@ -104,6 +104,8 @@ internal static void UpdateEnabled(bool tabEnabled, IMenuItem menuItem)
if (showMore)
{
var moreString = context.Resources.GetText(Resource.String.overflow_tab_title);
if (menu.Size() == maxBottomItems)
Copy link
Member

Choose a reason for hiding this comment

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

maybe we can grab menu.Size() only once here

@@ -104,6 +104,8 @@ internal static void UpdateEnabled(bool tabEnabled, IMenuItem menuItem)
if (showMore)
{
var moreString = context.Resources.GetText(Resource.String.overflow_tab_title);
if (menu.Size() == maxBottomItems)
menu.RemoveItem(menu.GetItem(menu.Size() - 1).ItemId);
Copy link
Member

Choose a reason for hiding this comment

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

I feel like in this else check we need to see if we've hit the "more" item and then remove iit if we do
https://github.com/dotnet/maui/pull/22589/files#diff-1787c6c4f33d04c0dd8bceddf563be45c136658b564e5a6be28161f37b79adc5R94-R99

like, if the user has 6 items it'll be
0,1,2,3,more

if they go down to 5 items then I think the more tab won't swap in the correct 5th item

And then instead of "Removing" this item. Can we retrieve the item using the MoreTabId to see if it was still added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@PureWeen you're right

Screen.Recording.2024-05-23.at.16.59.36.mov

@PureWeen
Copy link
Member

/azp run

@PureWeen PureWeen requested a review from jfversluis May 24, 2024 21:46
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jfversluis jfversluis merged commit d684d2c into dotnet:main May 29, 2024
49 checks passed
@jfversluis
Copy link
Member

Another @kubaflo original, thank you so much for this!

@github-actions github-actions bot locked and limited conversation to collaborators Jun 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout community ✨ Community Contribution platform/android 🤖
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IllegalArgumentException .NET MAUI 8 RC 2
5 participants