deepakaggarwal7 / react-social-login

MIT License
373 stars 142 forks source link

Handler User Close Popup ? #107

Open prakasa1904 opened 6 years ago

prakasa1904 commented 6 years ago

How to handler if user close pop up ? because its just callback to error fuction, no object data provide to be process....

And also, when we try to relogin, callback already set with Fetching user

ronihm commented 6 years ago

Same issue :(

Habbeunik commented 6 years ago

same issue over here

prakasa1904 commented 6 years ago

re mount your component guys, thats the only one solution. react-social-login use CDM for fetch the SDK. Its works for me.

avckp commented 6 years ago

@prakasa1904 how did you achieve remounting?

I declared a state variable rerender: false & then in failureHandler toggle it. And have added a key props to the SocialButtons that is a string which interpolates and creates new key each time, forcing the mount.

zaw8phyo commented 6 years ago

@prakasa1904 how do u remount component? pls, im newbie in react

prakasa1904 commented 6 years ago

just initial state, to make your component reactSocialLogin remount. For example rerender: false .

Then setState twice in the react social media error fallback. Then, the react social login component will remount and trigger CDM.

Or, you can modify lifecycle from this libs. Its better for me, I already modify this libs so it easier than before 💃

prakasa1904 commented 6 years ago
get reactSosmedLoginPorops() {
   // react social login props here
   return {
        ...props,
        onLoginFailure: this.errorCallback
   }
}

errorCallback = (err) => {
   // do something
   this.setState({ rerender: true }, () => { this.setState({ rerender: false; })})
}

render() {
   const { rerender } = this.sate;
   return !rerender ? <ReactSosmedLogin { ...this.reactSosmedLoginPorops }> : null;
}
zaw8phyo commented 6 years ago

thz 😃 @prakasa1904