Ad

How To Load A Scene A React Native

- 1 answer

I'm trying to find out how to load scenes without the Navigator Component. With the Navigator it implies history, so back and forward actions. But for example: If I have a Login screen which I don't want the navigator to appear on the top and after I login I don't need to go back. How would I do in this example? Do I use Navigator and tweak it? Or is there a better solution?

Ad

Answer

Why don't you use a simple wrapper component?
If the user is not logged in, display the relevant component and otherwise the other component(s).

....
render() {
    if(!this.state.isLoggedin) {
        return (<Login />);
    }
    return (<OtherView />);
    // Or
    return (<Navigator>.....</Navigator>)
}
...
Ad
source: stackoverflow.com
Ad