Skip to content

Calling the same modal component twice throws error on .dismiss() #298

@crockpotveggies

Description

@crockpotveggies

Here's what my routing tree looks at its simplest:

<Router>
  <Route name="errorModal" type="modal" component={ErrorModal}/>
  <Route name="mainScreen" initial={!needSignIn}>
    .. tab bar stuff ...
  </Route>
  <Route name="Login" initial={needSignIn} component={LoginScreen}/>
</Router>

Whenever an error happens within the app, I usually call Actions.errorModal({message: 'bad'}). However, during testing I noticed if I call that modal, then Actions.dismiss() and immediately afterwards call the error modal again then Actions.dismiss() a second time, the modal will not dismiss. Then, if I try to navigate to another part of the app, the app will crash with the following error:

screen shot 2016-03-08 at 3 51 49 pm

It looks like there's an error with resetting the route stack when calling dismiss() and the router can't handle a second modal being called immediately thereafter (with no other navigation). Is this a bug or am I not properly using modals?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions