NAXAM/bottomtabbedpage-xamarin-forms

LastSelectedIndex is not getting update

ssmsexe opened this issue · 2 comments

On tab change LastSelectedIndex should be update to the previous tab but it only updates for the first time only and not the subsequent calls.

@PouyaJavadzadeh

In which use-case, do you want to use LastSelectedIndex?

At this time, I only update it when

if (BottomTabbedRenderer.ShouldUpdateSelectedIcon && BottomTabbedRenderer.MenuItemIconSetter != null)
{
    BottomTabbedRenderer.MenuItemIconSetter?.Invoke(menuItem, renderer.Element.CurrentPage.Icon, true);

    if (renderer.LastSelectedIndex != pageIndex) {
        var lastSelectedPage = renderer.Element.Children[renderer.LastSelectedIndex];
        var lastSelectedMenuItem = menu.GetItem(renderer.LastSelectedIndex);
        BottomTabbedRenderer.MenuItemIconSetter?.Invoke(lastSelectedMenuItem, lastSelectedPage.Icon, false);
       renderer.LastSelectedIndex = pageIndex;
    }
}

Cheers.

Latest package includes the update for LastSelectedIndex.