Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After pushing data to firebase database I get null instead of snapshot in then() #1572

Closed
berpcor opened this issue Oct 6, 2018 · 3 comments
Assignees
Labels
plugin: database Firebase Realtime Database
Milestone

Comments

@berpcor
Copy link

berpcor commented Oct 6, 2018

One of my actions:

export const startAction = (item) => {


    return (dispatch) => {

        firebase.database().ref(`/users/${firebase.auth().currentUser.uid}/some/`)
            .push(item).then((snapshot) => {
                console.log('Added to firebase', snapshot,  snapshot.key);

            }).catch((err) => { console.log('errooooor', err) });
    }


}

My code is above. This code works with firebase directly, without RNFB, but in RNFB it doesn't work for some reasons. Error text: Cannot read property 'key' of null. Is it normal behavior?

@shiftrtech
Copy link

Maybe related to #1498

@Salakar
Copy link
Member

Salakar commented Oct 7, 2018

Duplicate of #893


Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:

@Salakar Salakar closed this as completed Oct 7, 2018
@invertase invertase locked as spam and limited conversation to collaborators Oct 7, 2018
@Salakar
Copy link
Member

Salakar commented Oct 27, 2018

Have just pushed a re-write of the push() logic to match the Web SDK.

Have added test cases from this issue and others which can be seen working here: https://github.com/invertase/react-native-firebase/blob/database-fixes/tests/e2e/database/ref/push.js#L73

This will land in v5.1.0, apologies for the delay on this one.


Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:

@Salakar Salakar self-assigned this Oct 27, 2018
@Salakar Salakar added the plugin: database Firebase Realtime Database label Oct 27, 2018
@Salakar Salakar added this to the v5.1.0 milestone Oct 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin: database Firebase Realtime Database
Projects
None yet
Development

No branches or pull requests

3 participants