If you have a view which does an app.navigate() when shown, the drawer breaks. The drawer will show the previous view instead of the drawer on the view navigated to.
In my case, I had a login remote view which would simply do an app.navigate() to the home view if the user was already logged in. I did this on data-before-show. The issue is something with timing. I ended up putting a setTimeout() on the app.navigate() to 1 second and then the navigation & drawer worked fine after.
In my case, I had a login remote view which would simply do an app.navigate() to the home view if the user was already logged in. I did this on data-before-show. The issue is something with timing. I ended up putting a setTimeout() on the app.navigate() to 1 second and then the navigation & drawer worked fine after.
@if (Request.IsAuthenticated)
{
AppsWebAppContext context = (AppsWebAppContext)ViewBag.AppContext;
string displayName = context.User.DisplayName;
string avatarUrl = (context.User.HasAvatar) ? context.User.AvatarSmallUrl : Url.GetUrlRoot() + "/Images/NoAvatar/small.jpg";
<
div
id
=
"viewLogin"
data-title
=
"Login"
data-role
=
"view"
data-before-show
=
"viewLoginOnBeforeShow"
data-hide
=
"onHide"
>
<
script
type
=
"text/javascript"
>
function viewLoginOnBeforeShow(e) {
showLoading();
onBeforeShow(e);
$("#userAvatar").attr("src", "@avatarUrl");
$("#userDisplayName").text("@displayName");
setTimeout(function () { navigateHome(); hideLoading(); }, 1000);
}
</
script
>
</
div
>
}