mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-28 20:25:41 +08:00
fix(auth): trigger initial listener asynchronously (#2897)
Applies to onAuthStateChanged, onIdTokenChanged & onUserChanged
This commit is contained in:
committed by
Mike Diarmid
parent
f9da620105
commit
227ab631a6
@@ -134,7 +134,9 @@ class FirebaseAuthModule extends FirebaseModule {
|
||||
);
|
||||
|
||||
if (this._authResult) {
|
||||
listener(this._user || null);
|
||||
Promise.resolve().then(() => {
|
||||
listener(this._user || null);
|
||||
});
|
||||
}
|
||||
return () => subscription.remove();
|
||||
}
|
||||
@@ -146,7 +148,9 @@ class FirebaseAuthModule extends FirebaseModule {
|
||||
);
|
||||
|
||||
if (this._authResult) {
|
||||
listener(this._user || null);
|
||||
Promise.resolve().then(() => {
|
||||
listener(this._user || null);
|
||||
});
|
||||
}
|
||||
return () => subscription.remove();
|
||||
}
|
||||
@@ -154,7 +158,9 @@ class FirebaseAuthModule extends FirebaseModule {
|
||||
onUserChanged(listener) {
|
||||
const subscription = this.emitter.addListener(this.eventNameForApp('onUserChanged'), listener);
|
||||
if (this._authResult) {
|
||||
listener(this._user || null);
|
||||
Promise.resolve().then(() => {
|
||||
listener(this._user || null);
|
||||
});
|
||||
}
|
||||
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user