Skip to content

Commit 048efdc

Browse files
author
Nicolas Garnier
committed
Added latest README to the dist for v1.1.1
1 parent 7334cc8 commit 048efdc

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

dist/README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ In your app:
3030

3131
### `FirebaseAuth` vs `StyledFirebaseAuth`
3232

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
3434

3535

3636
### Using `StyledFirebaseAuth` with a redirect
@@ -110,14 +110,18 @@ class SignInScreen extends React.Component {
110110
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
111111
firebase.auth.FacebookAuthProvider.PROVIDER_ID
112112
],
113-
// Sets the `signedIn` state property to `true` once signed in.
113+
// Avoid redirects after sign-in.
114114
callbacks: {
115-
signInSuccess: () => {
116-
this.setState({signedIn: true});
117-
return false; // Avoid redirects after sign-in.
118-
}
115+
signInSuccess: () => false
119116
}
120117
};
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+
}
121125

122126
render() {
123127
if (!this.state.signedIn) {
@@ -132,7 +136,8 @@ class SignInScreen extends React.Component {
132136
return (
133137
<div>
134138
<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>
140+
<a onClick={() => firebase.auth().signOut()}>Sign-out</a>
136141
</div>
137142
);
138143
}
@@ -158,7 +163,6 @@ render() {
158163
}
159164
```
160165

161-
<a href="#packing"/>
162166

163167
## Packing your app
164168

dist/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)