我是用反应性新的开发应用程序的新手。我正在尝试通过成功授权到下一个应用程序场景进行过渡。这是我的代码
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'
);
}); }); }
我知道如何通过按按钮触发过渡。通过添加这条代码
onPress={() => Actions.root()}>
,但我不知道如何从回调调用此功能。在字符串//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'
);
}); }); }