react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

onshapshot() or get() both method not work....in firestore

Open ektasahu027 opened this issue 8 years ago • 1 comments

I just want to store and fetch data into firestore and with the help of .add method i can store but i cant fetch data with onSnapshot method i got this error

screenshot_2018-07-27-09-57-30

Here is my code-

 constructor(props){
    super(props);
    this.ref = firebase.firestore().collection('interviews');
  }

  componentDidMount() {
    this.ref.add({ name: 'moo' });
    this.ref.onSnapshot(this.onCollectionUpdate) 
   }

   onCollectionUpdate = (querySnapshot) => {
          querySnapshot.forEach((doc) => {
            const { moo } = doc.data();
            console.log("ref",moo);
          })
        }

Here is my versions

"react": "16.3.2",
"react-native": "0.55.4",
"react-native-firebase": "^4.1.0",

Here is my dependencies


 compileSdkVersion 27
    buildToolsVersion "27.0.2"

    defaultConfig {
        applicationId "com.inquirr.inquirr"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
          multiDexEnabled true
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }

dependencies {
    compile project(':react-native-localization')
   compile project(':react-native-input-picker')
    compile project(':react-native-image-picker')
    compile project(':react-native-video')

  compile(project(':react-native-firebase')) {
         transitive = false
     }
       compile 'com.android.support:multidex:1.0.0'
        compile "com.google.android.gms:play-services-base:15.0.0"
     compile "com.google.firebase:firebase-core:15.0.0"
     compile "com.google.firebase:firebase-analytics:15.0.0"
        compile "com.google.firebase:firebase-auth:15.0.0"
        compile 'com.google.firebase:firebase-database:15.0.0'
          compile 'com.google.firebase:firebase-storage:15.0.0'
          compile 'com.google.firebase:firebase-firestore:15.0.0'

ektasahu027 avatar Jul 26 '18 13:07 ektasahu027

Please correctly format your code snippets and also please provide an actual error stack using the android ADB logs as it's not clear what your issue is here?

Will re-open once it's been updated and you reply here.

Thanks

Salakar avatar Jul 26 '18 16:07 Salakar