You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dist/README.md
+12-8Lines changed: 12 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ In your app:
30
30
31
31
### `FirebaseAuth` vs `StyledFirebaseAuth`
32
32
33
-
There are two components that allow you to add FirebaseUI auth to your application: `FirebaseAuth` and `StyledFirebaseAuth`. The difference is that `FirebaseAuth` has a reference to the Firebase UI CSS (it `requires` the CSS) whereas `StyledFirebaseAuth` includes the CSS directly in its built. For simplicity you should use `StyledFirebaseAuth` and for better performances and build sizes you should use `FirebaseAuth`. `FirebaseAuth` is meant to be used with a CSS/style loader as part of yor webpack built configuration. See the [Packing your app](#packing) section
33
+
There are two components that allow you to add FirebaseUI auth to your application: `FirebaseAuth` and `StyledFirebaseAuth`. The difference is that `FirebaseAuth` has a reference to the Firebase UI CSS (it `requires` the CSS) whereas `StyledFirebaseAuth` includes the CSS directly in its built. For simplicity you should use `StyledFirebaseAuth` and for better performances and build sizes you should use `FirebaseAuth`. `FirebaseAuth` is meant to be used with a CSS/style loader as part of yor webpack built configuration. See the [Packing your app](#packing-your-app) section
34
34
35
35
36
36
### Using `StyledFirebaseAuth` with a redirect
@@ -110,14 +110,18 @@ class SignInScreen extends React.Component {
110
110
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
111
111
firebase.auth.FacebookAuthProvider.PROVIDER_ID
112
112
],
113
-
//Sets the `signedIn` state property to `true` once signed in.
113
+
//Avoid redirects after sign-in.
114
114
callbacks: {
115
-
signInSuccess: () => {
116
-
this.setState({signedIn:true});
117
-
returnfalse; // Avoid redirects after sign-in.
118
-
}
115
+
signInSuccess: () =>false
119
116
}
120
117
};
118
+
119
+
// Listen to the Firebase Auth state and set the local state.
120
+
componentWillMount() {
121
+
firebase.auth().onAuthStateChanged((user) => {
122
+
this.setState({signedIn:!!user});
123
+
});
124
+
}
121
125
122
126
render() {
123
127
if (!this.state.signedIn) {
@@ -132,7 +136,8 @@ class SignInScreen extends React.Component {
132
136
return (
133
137
<div>
134
138
<h1>My App</h1>
135
-
<p>Welcome! You are now signed-in!</p>
139
+
<p>Welcome {firebase.auth().currentUser.displayName}! You are now signed-in!</p>
0 commit comments