симулятор не обновляется, реагирует на родную - PullRequest
0 голосов
/ 20 сентября 2018

Я новичок, чтобы реагировать на нативный язык, и в каждом уроке на youTube они просто сохраняют свой код в редакторе кода, и изменения могут быть внесены в симулятор, как только они перезагрузят симулятор.

, но этоне работает для меня.в моем случае симулятор показывает единственный экран-заставку, а затем приложение закрывается
, если я пытаюсь открыть приложение, щелкая его, оно показывает экран ошибок, который не меняется, даже если я удаляю этот код строки ошибки и снова запускаю симулятор черезтерминал

ниже - мой код.

import React, {Component} from 'react'; 
import {Platform, StyleSheet, Text, View} from 'react-native'; 
import * as firebase from 'firebase';

    const firebaseConfig = { apiKey: "AIzaSyCoC87qeRN995YBOUrUDAcIVQS4i33FuY4", authDomain: "helloreactapp.firebaseapp.com", databaseURL: "https://helloreactapp.firebaseio.com", projectId: "helloreactapp", storageBucket: "helloreactapp.appspot.com", messagingSenderId: "180878232923" };

   const firebaseApp = firebase.initializeApp(firebaseConfig); import {Container, Content, Header, Form, Input, Item, Button, Label } from 'native-base';

    export default class App extends React.Component{

    constructor(props){   super(props)   this.state = ({
        email: '',
        password: ''   }) }

    signUpUser = (email,password) => {

      try {

        if(this.state.password.length<6){
          alert("please enter atleast 6 character")
        }

         firebase.auth().createUserWithEmailandPassword(email,password)

      } catch (error) {
        console.log(error.toString())   } }

      render() {
        return (
                 <Container styles={styles.container}>
                  <Form>
                    <Item floatingLabel>
                        <Label>Email</Label>
                          <Input
                          onChangeText={(email) => this.setState(email)}
                          />
                    </Item>
                    <Item floatingLabel>
                        <Label>Password</Label>
                          <Input
                          secureTextEntry={true}
                          onChangeText={(password) => this.setState(password)}
                          />
                    </Item>
                    <Button style={{marginTop: 10}}
                    full
                    rounded
                    primary
                    onPress = {() => this.signUpUser(this.state.email,this.state.password)}
                    ><Text>Sign Up</Text>
                    </Button>
                  </Form>
                 </Container>
        );   } }

    const styles = StyleSheet.create({   container: {
        flex: 1,
         justifyContent: 'center',
        backgroundColor: '#F5FCFF',
        padding: 18,   },   welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,   },   instructions: {
        textAlign: 'center',
        color: '#333333',
        marginBottom: 5,   }, });

вот экран симулятора: enter image description here

1 Ответ

0 голосов
/ 20 сентября 2018

Unexpected token, expected "}" похоже, что вы забыли "}" в вашем App файле ... Ошибка также должна быть видна в окне Metro bundler ...

...