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
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'
);
}); }); }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.