dewango / BottomNavigationBarXF

Bottom Navigation Bar for Xamarin Forms
MIT License
187 stars 97 forks source link

CurrentPageChanged event is not fired #12

Closed Korayem closed 7 years ago

Korayem commented 8 years ago

I can't simply do this inside BottomBar Page

this.CurrentPageChanged += async (object sender, EventArgs e) =>
            {
                if (!AppSettings.IsLogged)
                {
                    await Navigation.PushAsync(new Welcome(), false);
                    return;
                }
            };
andreinitescu commented 8 years ago

This method:

https://github.com/thrive-now/BottomNavigationBarXF/blob/master/BottomBar.Droid/Renderers/BottomBarPageRenderer.cs#L161

needs to call tell Element property (which is the XamarinForms BottomBar) to raise CurrentPageChanged event (BottomBar is derived from MultiPage), something like this:

Element.RaiseCurrentPageChanged()

or something similar...

a PR would be welcome :)

nbsoftware commented 7 years ago

+1 Any news ?

nbsoftware commented 7 years ago

From what I understand, it seems that Xamarin Forms TabbedPage control lacks a virtual OnCurrentPageChanged method that can be overriden and called from the renderer.

Update: Err... forget this comment, didn't look at it hard enough ;) See final solution in PR below.

nbsoftware commented 7 years ago

Ok I have a fix for this. I'll do the PR tomorrow.

nbsoftware commented 7 years ago

There you go. PR #15.

sschmidt commented 7 years ago

PR merged