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

push() no longer returns anything #696

Closed
ergunyasar opened this issue Dec 18, 2017 · 2 comments
Closed

push() no longer returns anything #696

ergunyasar opened this issue Dec 18, 2017 · 2 comments
Labels
plugin: database Firebase Realtime Database

Comments

@ergunyasar
Copy link

Hello,
.push() method of 2.x version of react-native-firebase was returning a promise and when its resolved, I was getting an object inside then function. This object had a "path" prop which gave me the full path of inserted object.

However, currently I'm using 3.1.0 and then function returns null to me. Object is still inserting to database I dont think there is a problem with that. I can observe it.

firebase.database().ref('path/' + id).push({ key: 'value' }).then((result) => { console.log('result',result); //this wasn't null until the 3.1.0 version console.log(result.path); })

Environment

  1. Application Target Platform: IOS

  2. Development Operating System: macOS Sierra 10.12.6

  3. Build Tools: XCode 9.1

  4. React Native version: 0.51

  5. RNFirebase Version: 3.1.0

  6. Firebase Module: database

@Ehesp
Copy link
Member

Ehesp commented Dec 19, 2017

I think the functionality was incorrect, so we fixed it to match the web SDK. push shouldn't be a promise, as it's just generating a new key.

const key = firebase.database().ref('path/' + id).push({ key: 'value' });

@Ehesp Ehesp added the plugin: database Firebase Realtime Database label Dec 19, 2017
@chrisbianca
Copy link
Contributor

@ergunyasar This was changed as part of v3.0.0 to match the web SDK. See the conversation here: #147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: database Firebase Realtime Database
Projects
None yet
Development

No branches or pull requests

3 participants