Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

how to correctly dismiss a modal when using multiple navigators? #281

Open
vonovak opened this issue Nov 30, 2016 · 3 comments
Open

how to correctly dismiss a modal when using multiple navigators? #281

vonovak opened this issue Nov 30, 2016 · 3 comments

Comments

@vonovak
Copy link
Contributor

vonovak commented Nov 30, 2016

hi! The title says it all. I have followed the setup from here but it produces this:

issue

To explain: I have a master and nested navigator. Nested is used most of the time, in this example it displays the 1st, then then 2nd, and then the 3rd screen. From the 3rd I display a modal - which is displayed on the master navigator - with the "Filter" title. The current navigator now changes to master. Then I tap back and the modal goes down, but master stays as the active navigator, so when I tap back again, there are no more screens to pop, and thus the app exits. It this a bug / is this intended? The docs don't say anything about modals... Thanks for any input!

a bit more code on how the navigators are structured:

main.js:

    render() {
            ....
            return (
                    <NavigationProvider context={context}>
                        <StackNavigation
                            id="master"
                            initialRoute={Router.getRoute('App', {project: this.gotoProject, initialScreenString: this.initialScreenString})}/>
                    </NavigationProvider>
            );
        }
    }

app.js

    render() {
...
        return (
            <StackNavigation
                id="nested"
                defaultRouteConfig={{
                                 navigationBar: {
                                   backgroundColor: '#049cdb',
                                   tintColor: 'white',
                                 },
                               }}
                {...navbarConfig}
                initialRoute={Router.getRoute(this.props.initialScreenString, {project})}
            />
        );
    }
@vonovak vonovak changed the title how to correctly display a modal? how to correctly dismiss a modal when using multiple navigators? Dec 5, 2016
@vonovak
Copy link
Contributor Author

vonovak commented Dec 6, 2016

solved by inspiring at https://github.com/brentvatne/movieapp/tree/master/src/navigation

feel free to close this, for now I'll keep it open as a reference for others

@sonaye
Copy link

sonaye commented Feb 3, 2017

@vonovak how did you solve this issue?

@vonovak
Copy link
Contributor Author

vonovak commented Feb 3, 2017

@sonaye make sure to thoroughly check the navigation solution in the repo. Basically you want the modal to have its own StackNavigation or whichever other navigation you want, and not show just the screen, but show the screen in its own Navigator, if I remember correctly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants