Home Calling the callback function on successful authorization
Reply: 1

Calling the callback function on successful authorization

Sasha Tsvigun
1#
Sasha Tsvigun Published in 2017-12-07 22:55:44Z

I'm new to developing applications with reactive-native. I'm trying to make a transition with successful authorization to the next application scene. Here is my code

login = () => {
   firebaseApp.auth().signInWithEmailAndPassword(email, password
   ).then((userData) => {
       var uid = userData.uid;
       localStorage.save('uidKey', uid)
       console.log('uidKey');
       // transition
     }
   ).catch((error) => {
     AlertIOS.alert(
      'Login Failed!',
      'Please try again'
     );
   }); }); }

I know how to trigger a transition by pressing the button. By adding this line of code

onPress={() => Actions.root()}>

But I have no idea how to call this function from a callback. In the string //transition

Be so kind, help me

Chase DeAnda
2#
Chase DeAnda Reply to 2017-12-07 23:08:34Z

You should be able to import Actions and then fire off the same transition:

import { Actions } from 'react-native-router-flux';
...
login = () => {
    firebaseApp.auth().signInWithEmailAndPassword(email, password
    ).then((userData) => {
            var uid = userData.uid;
            localStorage.save('uidKey', uid)
            console.log('uidKey');
            // transition
            Actions.root()
        }
    ).catch((error) => {
        AlertIOS.alert(
            'Login Failed!',
            'Please try again'
        );
    }); }); }
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.300827 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO