Skip to content

IllegalArgumentException when changing number of tabbar pages - fix#22589

Merged
jfversluis merged 8 commits into
dotnet:mainfrom
kubaflo:fix-18251
May 29, 2024
Merged

IllegalArgumentException when changing number of tabbar pages - fix#22589
jfversluis merged 8 commits into
dotnet:mainfrom
kubaflo:fix-18251

Conversation

@kubaflo
Copy link
Copy Markdown
Contributor

@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
@dotnet-policy-service
Copy link
Copy Markdown
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
Copy Markdown
Member

PureWeen commented May 23, 2024

/azp run

@azure-pipelines

This comment was marked as outdated.

{
menu.RemoveItem(menu.GetItem(menu.Size() - 1).ItemId);
}
menu.Clear();
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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

@azure-pipelines
Copy link
Copy Markdown

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
if (showMore)
{
var moreString = context.Resources.GetText(Resource.String.overflow_tab_title);
if (menu.Size() == maxBottomItems)
Copy link
Copy Markdown
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

{
var moreString = context.Resources.GetText(Resource.String.overflow_tab_title);
if (menu.Size() == maxBottomItems)
menu.RemoveItem(menu.GetItem(menu.Size() - 1).ItemId);
Copy link
Copy Markdown
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
Copy Markdown
Contributor 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

Comment thread src/Controls/src/Core/Platform/Android/BottomNavigationViewUtils.cs Outdated
Comment thread src/Controls/src/Core/Platform/Android/BottomNavigationViewUtils.cs Outdated
@PureWeen
Copy link
Copy Markdown
Member

/azp run

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

Azure Pipelines successfully started running 3 pipeline(s).

Comment thread src/Controls/src/Core/Platform/Android/BottomNavigationViewUtils.cs
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz jsuarezruiz requested review from PureWeen and rmarinho May 28, 2024 10:59
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@jfversluis jfversluis merged commit d684d2c into dotnet:main May 29, 2024
@jfversluis
Copy link
Copy Markdown
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IllegalArgumentException .NET MAUI 8 RC 2

6 participants