React Navigation Preventing Going back to loading screen, reset not working

后端 未结 4 631
無奈伤痛
無奈伤痛 2021-01-21 13:32

I have a React Native application which I have implemented. Currently the app opens up on a loading screen which after mounting checks the firebase.auth().onAuthStateChang

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-21 13:43


    it is my solution :)
    I have StageArea page. it is bridge between from login to timeline . User is not login then go to LoginPage. User is login then go to Timeline. User press back button then again go to TimeLine page not go to login page .( Sory for my english)

    import React, { Component } from 'react';
    import { View  } from 'react-native';
    import LoginForm from './LoginForm';
    import Timeline from './Timeline';
    import firebase from 'firebase';
    import InitialPage from './InitialPage'
    class StageArea extends  Component {
    
    
        state = {isLoggin:''};
    
        componentWillMount(){
            firebase.auth().onAuthStateChanged((user) => {
                if (user) {
                        this.setState({ isLoggin:true})
                }else {
                    this.setState({ isLoggin:false})
    
                }
            })
    
        }
    
        render() {
            if(this.state.isLoggin)
            {
                return();
    
            }
            else if (this.state.isLoggin===false) {
                return();
            }
    
        }
    }
    
    export default StageArea;
    

提交回复
热议问题