Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Actions.reset() and <Modal/> #2742

Closed
phd13 opened this issue Dec 27, 2017 · 3 comments
Closed

Issue with Actions.reset() and <Modal/> #2742

phd13 opened this issue Dec 27, 2017 · 3 comments

Comments

@phd13
Copy link

phd13 commented Dec 27, 2017

Version

Tell us which versions you are using:

Expected behaviour

My Router is currently configured like this

const App = () => (
   <Provider store={configureStore()}>
        <Router createReducer={reducerCreate}>
            <Overlay key="overlay">
                <Modal
                    key="modal"
                    transitionConfig={() => ({screenInterpolator: CardStackStyleInterpolator.forFadeFromBottomAndroid})}
                >
                    <Stack key="root" hideNavBar>
                        <Scene
                            key="login"
                            component={Login}
                            initial
                            title="Login"
                            hideNavBar
                        />
                        <Scene
                            key="homeScreen"
                            navBar={() => <Hamburger scene={{}} isHome/>}
                            back={false}
                            component={Home}
                            panHandlers={null}
                        />
                        <Stack key="someKey">
                            <Scene
                                key="someKey"
                                navBar={Hamburger}
                                back
                                component={SomeComponent}
                            />
                            <Scene
                                key="someKey"
                                navBar={Hamburger}
                                back
                                component={SomeComponent}
                            />
                            <Scene
                                key="someKey"
                                navBar={Hamburger}
                                back
                                component={SomeComponent}
                            />
                        </Stack>
                        <Stack key="someKey">
                            <Scene
                                key="someKey"
                                navBar={Hamburger}
                                back
                                component={SomeComponent}
                            />
                            <Scene
                                key="someKey"
                                navBar={Hamburger}
                                back
                                component={SomeComponent}
                            />
                            <Scene
                                key="someKey"
                                navBar={Hamburger}
                                back
                                component={SomeComponent}
                            />
                        </Stack>
                        <Stack key="someKey">
                            <Scene
                                key="someKey"
                                navBar={Hamburger}
                                back
                                component={SomeComponent}
                            />
                            <Scene
                                key="someKey"
                                navBar={Hamburger}
                                back
                                component={SomeComponent}
                            />
                            <Scene
                                key="someKey"
                                navBar={Hamburger}
                                back
                                component={SomeComponent}
                            />
                        </Stack>
                    </Stack>
                    <Scene
                        navBar={Hamburger}
                        back
                        key="hamburger"
                        component={HamburgerMenu}
                    />
                </Modal>
            </Overlay>
        </Router>
    </Provider>
);

export default App;

When I call for Modal window (that is implemented according to docs provided) is pops up from the bottom of the screen, then I close it and tap on Home or Settings icon in my TabBar which resets the navigation stack to the scene needed. Modal is strictly required in my project.

Actual behaviour

When I tap on on Home or Settings icon in my TabBar (and call for Actions.reset('myKeyName')) it shows me an error with following statement

There is no route defined for key homeScreen. Must be one of 'root','hamburger'.

Other actions like POP, Replace are working as expected but they don't fit my needs because they won't clear the routing stack.
If I delete the <Modal...> </Modal> part, RESET works totally as expected but I lose this nice transition from bottom of the screen. I nested it as explained in the docs, can't figure out what's wrong...

Steps to reproduce

Null

@aksonov
Copy link
Owner

aksonov commented Jan 4, 2018

It is not supported at this moment, PR is welcome. Probably you could add custom transitions with usual stack container instead: #2628

@aksonov aksonov closed this as completed Jan 4, 2018
@riamon-v
Copy link

riamon-v commented Apr 16, 2020

Hello @aksonov ! I actually have the same problem, you said reset stack and Modals are not supported yet.
Is this the case now ? Or is there any other work around, other than the one mentioned above ?

@Allyday
Copy link

Allyday commented Apr 29, 2020

@riamon-v If you have multiple sub-stacks instead of just Scene in your "root" Stack, try removing the wrapping stack.
So instead of:

<Modal>
  <Stack key="root" />
    <Stack key="auth" />
    <Stack key="app" />
  </Stack>
  <Scene key="modal" />
</Modal>

Try:

<Modal>
  <Stack key="auth" />
  <Stack key="app" />
  <Scene key="modal" />
</Modal>

This could be a hacky way and I'm not sure if it's the intended solution but at least it works for now.

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

No branches or pull requests

4 participants