react-native-navigation的迁移库

actions.js 582B

123456789101112131415161718192021
  1. import * as types from './actionTypes';
  2. export function appInitialized() {
  3. return async function(dispatch, getState) {
  4. // since all business logic should be inside redux actions
  5. // this is a good place to put your app initialization code
  6. dispatch(changeAppRoot('login'));
  7. };
  8. }
  9. export function changeAppRoot(root) {
  10. return {type: types.ROOT_CHANGED, root: root};
  11. }
  12. export function login() {
  13. return async function(dispatch, getState) {
  14. // login logic would go here, and when it's done, we switch app roots
  15. dispatch(changeAppRoot('after-login'));
  16. };
  17. }