Show splash screen before show main screen in react native without using 3rd party library

前端 未结 5 1302
忘掉有多难
忘掉有多难 2021-01-31 10:47

I am beginner in react native so may be my question seems silly to all experts.

but I am struggling with a basic feature that i want to implement that i want to start my

5条回答
  •  有刺的猬
    2021-01-31 11:37

    You may try this example.There is no need stacknavigator in splash screen.

    constructor(props){
        super(props);
        this.state = {
            timePassed: false,
        };
    }
    
    componentDidMount() {
        setTimeout( () => {
            this.setTimePassed();
        },1000);
    }
    
    setTimePassed() {
        this.setState({timePassed: true});
    }
    
    render() {
        if (!this.state.timePassed) {
            return ;
        } else {
            return ;
        }
    }
    

提交回复
热议问题