Closed selyon closed 5 years ago
The problem is the version of the firebase-firestore library. With update 18.0.0 they changed the behaviour of timestamp fields:
The timestampsInSnapshotsEnabled setting is now enabled by default. Timestamp fields that read from a DocumentSnapshot are now returned as Timestamp objects instead of Date objects. This is a breaking change; developers must update any code that expects to receive a Date object
Yes, but this option (managing timestamp as needed for firestore) is still marked as unsupported in RN Firebase documentation.
Hey, Is there any reason why you're using version 18 of the Android SDK when the docs specifically say 17.1.5? https://rnfirebase.io/docs/v5.x.x/firestore/android
Version 18 of the Android SDK is not yet supported. Likewise for iOS, you should use <= v5.15 of the pods.
We're working on adding support
Is there any reason why you're using version 18 when the docs specifically say 17.1.5? https://rnfirebase.io/docs/v5.x.x/firestore/android
Version 18 SDK is not yet supported.
Android is not mentioned here, it says 17.1.5 only in the example of the installation guide and it's not written that it's the last version supported. I always update my libraries to the last version if i can, that's why i tried version 18.
Had the same issue on IOS in version 5.16 of 'Firebase/Firestore', works when i downgraded to 5.15
Downgrading to 5.15 worked for me, too.
@selyon, the version is shown in the dependency example code on the link above as 17.1.5, the readme on the root of the repo is for Google play services SDK which is different.
I can see how this can cause some confusion so I think we'll remove the versions from the root and refrer to them specifically in each module. Sorry for any confusion š
Also experienced this for iOS. Downgraded the Firebase/Firestore pod to 5.15 and it worked.
Hello š, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.
Hey all, please could you try the recently release v5.3.0 version of this library.
Changelog is here: https://rnfirebase.io/docs/v5.x.x/releases/v5.3.x
Did anyone actually have to change anything for this to work again? I'm getting the same issue where Timestamp is coming back as NULL but I can see it in the firebase back end. Do I have to do any converting in the code?
iOS: react-native-firebase v5.5.6
pod 'Firebase/Core', '~> 6.3.0' pod 'Firebase/Auth', '~> 6.3.0' pod 'Firebase/Firestore', '~> 6.3.0'
Issue
Every query that get data from firestore return null dates. In firestore the dates are timestamp fields ( see attachment for examples)
Project Files
This is the list of my dependencies, if it's usefull
"dependencies": { "moment": "^2.24.0", "native-base": "^2.8.1", "react": "16.6.1", "react-moment": "^0.8.4", "react-native": "0.57.6", "react-native-device-info": "^0.24.3", "react-native-firebase": "^5.2.1", "react-native-gifted-chat": "^0.6.0", "react-native-image-picker": "^0.28.0", "react-native-mauron85-background-geolocation": "^0.5.0-alpha.50", "react-native-navigation": "^1.1.493", "react-native-vector-icons": "^6.1.0", "react-redux": "^5.1.1", "redux": "^4.0.1", "rn-fetch-blob": "^0.10.15" }
I only work with Android at the moment
Android
android/build.gradle
:apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [ entryFile: "index.js" ]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android { compileSdkVersion 27 buildToolsVersion '28.0.3'
}
dependencies { implementation project(':react-native-image-picker') implementation project(':rn-fetch-blob') implementation project(':react-native-device-info') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.facebook.react:react-native:+" // From node_modules implementation project(':react-native-firebase') implementation project(':react-native-vector-icons') implementation project(':react-native-navigation') implementation project(':react-native-mauron85-background-geolocation') implementation "com.android.support:appcompat-v7:27.1.1" implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:design:27.1.1' implementation 'com.google.firebase:firebase-core:16.0.6' implementation 'com.google.firebase:firebase-auth:16.1.0' implementation "com.google.firebase:firebase-firestore:18.0.0" implementation 'com.google.firebase:firebase-database:16.0.6' implementation 'com.google.firebase:firebase-storage:16.0.5' implementation 'com.google.firebase:firebase-messaging:17.3.4' implementation 'com.google.android.gms:play-services-location:16.0.0' }
// Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' }
project.ext.vectoricons = [ iconFontNames: [ 'Ionicons.ttf' ] // Name of the font files you want to copy ]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" apply plugin: 'com.google.gms.google-services'
android/app/build.gradle
:// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { ext { buildToolsVersion = "27.0.3" minSdkVersion = 16 compileSdkVersion = 27 targetSdkVersion = 26 supportLibVersion = "27.1.1" googlePlayServicesVersion = "11.8.0" gradle3EXPERIMENTAL = "yes" oreoEXPERIMENTAL = "yes" } repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.3.0' classpath 'com.google.gms:google-services:4.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } }
allprojects { repositories { mavenLocal() google() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } maven { url 'https://maven.google.com' } } }
task wrapper(type: Wrapper) { gradleVersion = '4.4' distributionUrl = distributionUrl.replace("bin", "all") }
android/settings.gradle
:rootProject.name = 'overmoverDev' include ':react-native-image-picker' project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android') include ':app'
include ':react-native-device-info' project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
include ':react-native-firebase' project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-navigation' project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app/')
include ':react-native-mauron85-background-geolocation-common' project(':react-native-mauron85-background-geolocation-common').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mauron85-background-geolocation/android/common') include ':react-native-mauron85-background-geolocation' project(':react-native-mauron85-background-geolocation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mauron85-background-geolocation/android/lib')
include ':rn-fetch-blob' project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android')
MainApplication.java
:package com.selyon.overmoverdev;
import com.facebook.react.ReactPackage;
import com.oblador.vectoricons.VectorIconsPackage; import com.reactnativenavigation.NavigationApplication; import com.reactnativenavigation.bridge.NavigationReactPackage; import io.invertase.firebase.RNFirebasePackage; import io.invertase.firebase.auth.RNFirebaseAuthPackage; import io.invertase.firebase.firestore.RNFirebaseFirestorePackage; import io.invertase.firebase.database.RNFirebaseDatabasePackage; import io.invertase.firebase.storage.RNFirebaseStoragePackage; import io.invertase.firebase.messaging.RNFirebaseMessagingPackage; import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage; import com.marianhello.bgloc.react.BackgroundGeolocationPackage; import com.learnium.RNDeviceInfo.RNDeviceInfo; import com.imagepicker.ImagePickerPackage; import com.RNFetchBlob.RNFetchBlobPackage;
import java.util.Arrays; import java.util.List;
import com.google.firebase.database.FirebaseDatabase;
public class MainApplication extends NavigationApplication {
}
AndroidManifest.xml
:<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="">
Environment
N/A
N/A
React Native
version:React Native Firebase
library version:Firebase
module(s) you're using that has the issue:TypeScript
?N/A
ExpoKit
?ExpoKit
N/A
Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on Twitter