Skip to content

Create scenes within a scene #353

@alexmngn

Description

@alexmngn

My application is divided in multiple sub applications that has its own route.
For example, the Login page is a part of the app that work completely independently of the rest of the app. So I am trying to do the following:

index.js

const scenes = Actions.create(
    <Scene key="start" hideNavBar={true}>
        <Scene key="landing" component={Landing} initial={true} />
        <Scene key="login" schema="modal" direction="vertical" component={Login}></Scene>
    </Scene>
);

The Landing component calls Login to open a new modal with the login scene.
Login should have its own route, the parent shouldn't be aware of what the Login scene does, so I am trying to create new scenes in this file.
But if I call Actions with the name of a scene from index.js, in my case I try to go back to the start scene, it doesn't recognize it, so I can't go back. I also tried to use Actions.pop() but it doesn't work either.

login.js

const scenes = Actions.create(
    <Scene key="loginContainer">
        <Scene key="loginPage1" component={LoginPage1} title="Login" initial={true} leftTitle="Cancel" onLeft={() => {
                Actions.startContainer(); // Want to go back to the previous page, this doesn't work
            }} />
        <Scene key="loginPage2" component={LoginPage2}></Scene>
    </Scene>
);

class Login extends Component {
    render() {
        return (
            <Router scenes={scenes} />
        );
    }
}

Any suggestion how I could do that?
Thanks

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