mariodev12 / react-native-menu-animation-recipe

React Native with animated menu.
34 stars 9 forks source link

White Screen at Login Page #2

Closed saeedhei closed 7 years ago

saeedhei commented 7 years ago

Hellow I added Login Page with your tutorial, But I Can't see login and signup, Just I have a White Screen and after 10 secend I got setting a timer for a long period, What Should I Do? This is my Code: index.android.js

import React, { Component } from 'react';
import CustomComponents from 'react-native-deprecated-custom-components';
import SplashScreen from 'react-native-splash-screen'
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';

import App from './component/App'
import * as firebase from 'firebase'
import Login from './component/Login'
import FireBaseApp from './lib/firebase'

export default class Mohajerkade extends Component {
  constructor(props) {
    super(props)
    this.state = {
      initialView: null,
      userLoaded: false
    }
    this.getInitialView()
    this.getInitialView = this.getInitialView.bind(this)
  }

  getInitialView() {
    firebase.auth().onAuthStateChanged((user) => {
      let initialView = user ? 'App' : 'Login'

      this.setState({
        userLoaded: true,
        initialView
      })
    })
  }

  componentDidMount() {
    SplashScreen.hide();
  }

  configureScene(route) {
    if (route.sceneConfig) {
      return route.sceneConfig
    } else {
      return ({
        ...CustomComponents.Navigator.SceneConfigs.HorizontalSwipeJumpFromRight,
        gestures:{}
      });
    }
  }

  renderScene(route, navigator) {
    var globalProps = { navigator }
    switch (route.id) {
      case 'App':
        return (
          <App navigator={navigator} />
        )
      case 'Login':
        return (
          <Login navigator={navigator} />
        )
    }
  }
  render() {
    if (this.userLoaded) {
      return (
        <CustomComponents.Navigator
          initialRoute={{
            id: this.state.initialView
          }}
          renderScene={this.renderScene}
          configureScene={this.configureScene}
        />
      );
    } else {
      return null
    }
  }
}

AppRegistry.registerComponent('Mohajerkade', () => Mohajerkade);

And This is my Login Page Code:

import React, { Component } from 'react'
import {
    Text,
    StyleSheet,
    View,
    TextInput,
    TouchableHighlight
} from 'react-native'

export default class Login extends Component {
    render() {
        return (
            <View>
                <TextInput />
                <TextInput />
                <TouchableHighlight>
                    <Text >Login</Text>
                </TouchableHighlight>
                <TouchableHighlight>
                    <Text>Signup</Text>
                </TouchableHighlight>
            </View>
        )
    }
}
saeedhei commented 7 years ago

I had Problem For First Time and I Changed return null , And Solved, for secend time I put Your Code, I Don't Know Why I had Problem in First Time