Hello. I'm trying to use this library in conjunction with react-native-maps. The later package (which is in the community react repos!) is insistent on using Cocoapods and in fact doesn't work using react-native link
(reference: https://github.com/react-community/react-native-maps/blob/master/docs/installation.md )... which sods law is one of the unrecommended ways to use this library...
Bit of a predicment i decided to follow the Cocoapods route as I've used this Firebase library on couple of projects this way and haven't noticed any issues... till now...
So i can get the app to run, the maps to load and even initially get data from the Firebase Firestore database (even though it gives me red screen of death - see below). Trying to figure out where this error is coming from, it simply is this one line of code of me just getting reference of one of collection in the Firestore DB:
const { firestore: firestoreSingleton } = firebase
const firestore = firestoreSingleton()
const ref = firestore.collection('SomeCollection')
export const getSomething = async () => {
const data = await ref.get() // THIS LINE SHOWS THE RED SCREEN OF DEATH
return data
}
This is my pod file:
target 'App' do
rn_path = '../node_modules/react-native'
rn_maps_path = '../node_modules/react-native-maps'
# See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
'Core',
'CxxBridge',
'DevSupport',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
]
# React Native third party dependencies podspecs
pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
# If you are using React Native <0.54, you will get the following error:
# "The name of the given podspec `GLog` doesn't match the expected one `glog`"
# Use the following line instead:
#pod 'GLog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec"
pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"
# react-native-maps dependencies
pod 'react-native-maps', path: rn_maps_path
# pod 'react-native-google-maps', path: rn_maps_path # Remove this line if you don't want to support GoogleMaps on iOS
# pod 'GoogleMaps' # Remove this line if you don't want to support GoogleMaps on iOS
# pod 'Google-Maps-iOS-Utils' # Remove this line if you don't want to support GoogleMaps on iOS
# Firebase
pod 'Firebase/Core', '~> 4.13.0'
pod 'Firebase/Firestore'
# pod 'Fabric', '~> 1.7.6't
# pod 'Crashlytics', '~> 3.10.1'
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
# pod 'RNFS', :path => '../node_modules/react-native-fs'
pod 'react-native-fast-image', :path => '../node_modules/react-native-fast-image'
pod 'RNSVG', :path => '../node_modules/react-native-svg'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
if target.name == "React"
target.remove_from_project
end
end
end
Application Target Platform: iOS only.
Development Operating System: macOS High Sierra
Build Tools: Xcode Version 9.4
React Native
version: 0.54.4
React Native Firebase
Version: 4.1.0
Firebase
Module: Core & Firestore
Are you using typescript
? No
This is the red screen of death error:
Same problem, appears to be related to data coming down the line. Issue appears on both Android and iOS for me. Still trying to work out exactly the cause. Did you get to the bottom of it?
OK! Solved it for me!!!
Turns out I had a text field with the word Infinity... which got interpreted as the numeric value... Inifinity... changed it to a string in the firestore console and all is good! Hope you solve your issue.
@rknell Sounds an interesting one! Could you take a screenshot of exactly what you mean by the 'word Infinity' in the console?
@SukhKalsi could you show us what data you have on the ref, on the console?
Thanks for the insight @rknell - glad you got it resolved π deffo a data parsing issue for sure, unfortunately i have a lot of data in this Firestore (several hundred collections with each collection having about 25+ fields π) -> inherited from an existing app so also need to be careful what i do (annoyingly Firestore doesn't have a export feature)
Interestingly once the initial request has gone out the Red Screen of Death is slightly different but points to JSON issue...
Will dig into the source and see what I can find
@Ehesp This is what I mean by "Infinity"
So this will work no problems (as it should!)
This however will crash the app when it tries to read the record:
You will notice that the console recognises "Infinity" as a number if I don't type it correctly:
@SukhKalsi Yeah I was very lucky, only having about 40 records to dig through. My break was in a nested collection though which complicated the issue. To find it I put a limit on the data, and did some filtering to see exactly when it broke. If you could load each record, one at a time, and log it out to console as you go, you might be able to track down the offending record too.
I didn't get the red screen afterwards, so there is a chance your data may not be "Inifinity" but NaN as per the first error. The only reason this occurred in the first place is because there is a damn company around here called infinity!
So I managed to decipher what was happening by using the debugging tools in Xcode. My issue is pretty similar to yours @rknell but as you suggested was actually related to NaN
values being populated (how the data go in like this is beyond me).
Due to the volume of data (which i certainly wasn't going to cleanse!), I made the following addition here:
if (!value || [[value description].lowercaseString isEqual: @"nan"]) {
typeMap[@"type"] = @"null";
}
Within this line:
https://github.com/invertase/react-native-firebase/blob/master/ios/RNFirebase/firestore/RNFirebaseFirestoreDocumentReference.m#L191-L192
Whether thats worthy of going in as a PR is up to the peeps managing this project π
@SukhKalsi @rknell would you be able to test if this is an issue on Android also?
I can potentially push up a small change to iOS to handle these correctly so you don't have to do any data changes. (@SukhKalsi thanks for the suggested change also)
Loving react-native-firebase
and the support we provide? Please consider supporting us with any of the below:
React Native Firebase
and Invertase
on Twitter I can 100% confirm it's also an Android issue, iOS was where it was
reported for me. But Android was what I used to test it was resolved
On Sat., 4 Aug. 2018, 2:57 pm Michael Diarmid, notifications@github.com
wrote:
@SukhKalsi https://github.com/SukhKalsi @rknell
https://github.com/rknell would you be able to test if this is an issue
on Android also?I can potentially push up a small change to iOS to handle these correctly
so you don't have to do any data changes. (@SukhKalsihttps://github.com/SukhKalsi thanks for the suggested change also)
Loving react-native-firebase and the support we provide? Please consider
supporting us with any of the below:
- π Back financially via Open Collective
https://opencollective.com/react-native-firebase/donate- π Follow React Native Firebase https://twitter.com/rnfirebase and
Invertase https://twitter.com/invertaseio on Twitter- π Star this repo on GitHub βοΈ
β
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/invertase/react-native-firebase/issues/1357#issuecomment-410423745,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFmlbdSvIzpkBuBOoBBFvWutM_o9VcJmks5uNSmagaJpZM4Vmifq
.
@rknell ok cool, thanks for confirming. I'll look into adding support for these in a moment. π
Thanks for looking into this @Salakar :) For this project I'm only targeting iOS (Android app was already built) so I've pretty much neglected the state of Android. I can try get a small project in Android with the same dataset (I would assume it'll behave the same - as @rknell confirmed on his project with Infinity
issue).
@rknell also fixed searching for a Infinity or NaN value on a Number field
Any solutions for Android? With changed from @SukhKalsi, it works.
But I don't know how to update in Android.
Thanks.
Support for NaN and Infinity numbers has landed for Android and IOS today - on v5.0.0-rc5 - this will work with the JS equivalents of NaN/Infinity instead of null or crashing.
Thanks
Loving react-native-firebase
and the support we provide? Please consider supporting us with any of the below:
React Native Firebase
and Invertase
on Twitter I'm on [email protected]
and pod 'Firebase/Firestore', 5.15.0'
and my app crashes when I try to load -Infinity
from Firestore. It took me good hours to figure this out.
Care to verify and fix that so other people save some hours? Crashes only on iOS. I was testing in "production" mode only.
I have same issue when fetch firebase configs with getValues
method. Crash on android version 4.4 :( Have any suggest to solve it?
@sinhpn92 can you confirm that the problem is a β-Infinityβ value? That is, this is still crashing, and on a version after v5? If so, maybe we need to reopen
@mikehardy Exactly. It's infinity value.
I'm using version 5.2.5.
I have added this code to solve it:
Double doubleValue = null;
try {
doubleValue = value.asDouble();
if (Double.isInfinite(doubleValue)) doubleValue = null;
} catch (Exception e) { }
Dang - @Salakar @Ehesp looks like both of you touched on this one, and itβs a zombie? See the most recent comments
I'll check this out on Firestore. Not sure how Infinity works on remote config? Isn't it just strings (+ empty strings).
Okay so just confirmed setting -Infinity
is not handled at all on v5. On v6 I have implemented this (still WIP) and added tests to cover everything.
Also unrelated but found another bug, setting new Date()
as a value causes it to be an empty object on Firestore, which now is handled as a Timestamp as the web SDK does.
I can backport to a v5 release at some point.
If you at least linked the relevant commits here someone might be able to backport if they were motivated and I could shepherd it to release. That seems like an appropriate support commitment for v5 - Iβm willing to release things and try to maintain quality but itβs going to have to be community effort I think, as the focus should be full for v6 IMHO :-)
Ok so the setup is different on v6 as the serialisation has been changed, however the concept is still the same:
1 - The v5 infinity check needs breaking out to support both positive & negative infinity. The type for negative infinity is -infinity
.
2 - On native, the types need updating to match the changes from JS land.
3 - The native type needs to be handled to support negative infinity.
When converting back on native, the value also needs to be handled.
On JS handling of native data, the value needs to be returned.
Let me know on Discord if you need help. Thanks a lot!
Also @mikehardy a JS only change for v5:
The Date
check is incorrect and doesn't work. I added a new isDate util, and it should also return a Timestamp
.
Hello π, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
This is now fixed on v6 [changelog]
Backporting from v6 will prove difficult as Firestore v6 is a full re-write to improve serialisation performance and better match the Web SDK (see changelog above)
However, what needs changing on v5 is to add negative Inifinity support in the same way as positive Infinity is currently added on v5 (key locations of this below if someone wants to PR v5 support):
JS:
Android:
iOS:
Will close this as it's fixed on v6.
Most helpful comment
Support for NaN and Infinity numbers has landed for Android and IOS today - on v5.0.0-rc5 - this will work with the JS equivalents of NaN/Infinity instead of null or crashing.
Thanks
Loving
react-native-firebase
and the support we provide? Please consider supporting us with any of the below:React Native Firebase
andInvertase
on Twitter