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 {
106106
107107 // The component's Local state.
108108 state = {
109- signedIn : false // Local signed-in state.
109+ iSignedIn : false // Local signed-in state.
110110 };
111111
112112 // Configure FirebaseUI.
@@ -126,10 +126,15 @@ class SignInScreen extends React.Component {
126126
127127 // Listen to the Firebase Auth state and set the local state.
128128 componentDidMount () {
129- firebase .auth ().onAuthStateChanged (
130- (user ) => this .setState ({signedIn : !! user})
129+ this . unregisterAuthObserver = firebase .auth ().onAuthStateChanged (
130+ (user ) => this .setState ({isSignedIn : !! user})
131131 );
132132 }
133+
134+ // Make sure we un-register Firebase observers when the component unmounts.
135+ componentWillUnmount () {
136+ this .unregisterAuthObserver ();
137+ }
133138
134139 render () {
135140 if (! this .state .signedIn ) {
You can’t perform that action at this time.
0 commit comments