Skip to content

Commit

Permalink
fixed popping back to empty stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Healey committed Oct 9, 2018
1 parent 5b8cbcc commit 6d65e83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Transitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static class Transitions
public static void Instant(GameObject from, GameObject to, Action onComplete = null)
{
if (from != null) from.SetActive(false);
to.SetActive(true);
if (to != null) to.SetActive(true);
if (onComplete != null) onComplete();
}
}
Expand Down
11 changes: 7 additions & 4 deletions ViewStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void Init()

public void Push(string newScreenId, Action<GameObject> initView = null, ViewTransition transition = null)
{
if (!isInitialized) throw new Exception("ViewStack is not yet initialized. Listen for OnInitialized before you start navigating");
if (!isInitialized) throw new Exception("ViewStack is not yet initialized.");

if (transitionIsInProgress)
{
Expand Down Expand Up @@ -132,11 +132,14 @@ private void PerformTransition(ViewTransition transition, Action manipulateState

var oldView = oldTopViewEntry != null ? oldTopViewEntry.View : null;
transitionIsInProgress = true;
transition(oldView, TopViewEntry.View, () =>
transition(oldView, TopViewEntry != null ? TopViewEntry.View : null, () =>
{
// notify the new view that transition has completed
TopViewEntry.NotifyView<ITransitionCompleteHandler>(
t => t.HandleTransitionComplete());
if (TopViewEntry != null)
{
TopViewEntry.NotifyView<ITransitionCompleteHandler>(
t => t.HandleTransitionComplete());
}

if (OnTransitionComplete != null)
{
Expand Down

0 comments on commit 6d65e83

Please sign in to comment.