I just updated to rnfirebase 5.1.0 from 5.0 and noticed that onAuthStateChanged
works in a strange way on ios simulator. I need to reload app twice for the method to return a result. The first time I reload the app the callback is never invoked! Then after reloading again it works as expecred. If I reload again it does not work and it repeats.
ios/Podfile
:pod 'Firebase/Core', '~> 5.11.0'
pod 'Firebase/Auth', '~> 5.11.0'
pod 'Firebase/Firestore', '~> 5.11.0'
pod 'Firebase/Functions', '~> 5.11.0'
pod 'Firebase/Storage', '~> 5.11.0'
pod 'Firebase/Messaging', '~> 5.11.0'
pod 'Firebase/DynamicLinks', '~> 5.11.0'
# N/A
AppDelegate.m
:// N/A
android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
iOS 12
10.14
N/A
N/A
Xcode 10
React Native
version:0.57.4
React Native Firebase
library version:5.1
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
and Invertase
on TwitterI'm having the same issue. The first time I run the app onAuthStateChanged is triggered properly, If I refresh once, it won't return anything but If I refresh again, It works. And If do it one more time, It happens again and so on.
The same exact scenario is happening to me as outlined in the issue description and in @FacuAcosta 's comment. Same Firebase versions too.
happens to me too on iOS 12.1 simulator (RN 0.57.5, RNF 5.1.0)
onAuthStateChanged
calls its callback every two reloads!
Is anyone having this issue on Android? Or is it just iOS?
Thanks
Happening to me on iOS as well after upgrading from 5.0 to 5.1, some additional info
Simulator (Debug)
signOut
it doesn't seem to trigger auth change, only after reloadingPhysical Device (Release)
There seems to be an unusually long delay until onAuthChange is triggered / initialised, but it always works.
For my case, the following code makes onAuthStateChanged
broken.
firebase.auth().signOut().then(() => { CodePush.restartApp(false) });
I checked that iOS native callback addAuthStateDidChangeListener
is triggered. But, in the sendJSEvent
, emitter.bridge
is null
. This is the reason that JS onAuthStateChanged
is not triggered.
I make PR for this. Could you check if it resolves this issue?
You can install by modifying package.json
like below.
"react-native-firebase": "git+https://github.com/hayanmind/react-native-firebase.git#1b5a9641383f1842d0a439109487c38903d1df2c"
@IljaDaderko @levani
@ghsdh3409 Yep, your fix works on my end 馃憤
@ghsdh3409 just looked at your change and it makes sense - will get your PR merged for a patch release 馃憤
Most helpful comment
@ghsdh3409 just looked at your change and it makes sense - will get your PR merged for a patch release 馃憤