Answer the question
In order to leave comments, you need to log in
Why doesn't routing work in react native router flux during authorization?
Hello. I do authorization in react native. I am using react native router flux routing module. Here is the initial component.
export default class authreactnative extends Component {
state = {
loggedIn:false,
}
componentWillMount = () => {
firebaseApp.auth().onAuthStateChanged((user) => {
this.setState({
loggedIn:!!user,
});
});
}
render() {
const { loggedIn } = this.state;
const rootSelector = () => loggedIn ? 'home' : 'login';
return (
<Router>
<Scene key="root" tabs={true} selector={rootSelector}>
<Scene key="login" >
<Scene key="authuser" initial={true} component={Auth} title="auth"/>
</Scene>
<Scene key="home">
<Scene key="appuser" initial={true} component={App} title="app"/>
</Scene>
</Scene>
</Router>
);
}
}
Key authuser is already defined!
Key login is already defined!
Key appuser is already defined!
Key home is already defined!
Key root is already defined!
Answer the question
In order to leave comments, you need to log in
As far as I remember, react-native-router-flux always renders the first scene, which is specified in the root component. Perhaps you should try to move the authorization to a separate component from where to make the transition to the desired scene upon successful authorization.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question