Baseflow / Xamarin-Sidebar

A slideout navigation control for Xamarin.iOS
https://baseflow.com
Apache License 2.0
113 stars 67 forks source link

Shadow disappears before closing #54

Open Nerkyator opened 8 years ago

Nerkyator commented 8 years ago

Hi! I've noticed that side shadow disappears before closing menu animation ends. It happens on both sides.

I've fixed it with this implementation of CloseMenu in Sidebar.cs


        public void CloseMenu(bool animate = true)
        {
            if (!IsOpen || Disabled)
                return;
            MenuViewController.View.EndEditing(true);

            UIView.AnimateNotify(animate ? Sidebar.SlideSpeed : 0,
                0,
                UIViewAnimationOptions.CurveEaseInOut,
                () =>
                {
                    _sidebarContentArea.CloseAnimation();
                    _sidebarContentArea.AfterCloseAnimation(TapGesture);
                    IsOpen = false;
                },
                (finished) =>
                {
                    if (finished)
                        HideShadow();
                });
}

Basically same as original but used AnimateNotify wrapper to have completion handler