HectorBlisS / ReactNativeFirebase

2 stars 4 forks source link

Error en agreagar item #1

Open Eder87rh opened 7 years ago

Eder87rh commented 7 years ago

Tenias un error en agregar item carnal.

Te mandaría PR pero que weba jajaja asi que solo pegaré por aqui el codigo del método:

`agregarItem = () => { let nuevo = this.state.nuevo

    // Get a key for a new Post.
    let newPostKey = firebase.database().ref().child('items').push().key;

    nuevo = {
                id:newPostKey,
                name:nuevo,
                done:false
            };

    // Write the new post's data simultaneously in the posts list and the user's post list.
    let updates = {};
    updates['/items/' + newPostKey] = nuevo;

    return firebase.database().ref().update(updates);

    //firebase.database().ref('items').push(nuevo);

    this.state.lista.push(nuevo);
    this.setState({lista: this.state.lista});
    console.log(nuevo);
}`
Eder87rh commented 7 years ago

Por cierto gracias por motivarme a aprender React Native 👍