File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ class SignInScreen extends React.Component {
106
106
107
107
// The component's Local state.
108
108
state = {
109
- signedIn : false // Local signed-in state.
109
+ iSignedIn : false // Local signed-in state.
110
110
};
111
111
112
112
// Configure FirebaseUI.
@@ -126,10 +126,15 @@ class SignInScreen extends React.Component {
126
126
127
127
// Listen to the Firebase Auth state and set the local state.
128
128
componentDidMount () {
129
- firebase .auth ().onAuthStateChanged (
130
- (user ) => this .setState ({signedIn : !! user})
129
+ this . unregisterAuthObserver = firebase .auth ().onAuthStateChanged (
130
+ (user ) => this .setState ({isSignedIn : !! user})
131
131
);
132
132
}
133
+
134
+ // Make sure we un-register Firebase observers when the component unmounts.
135
+ componentWillUnmount () {
136
+ this .unregisterAuthObserver ();
137
+ }
133
138
134
139
render () {
135
140
if (! this .state .signedIn ) {
You can’t perform that action at this time.
0 commit comments