How to use the react-native-router-flux.ActionConst.FOCUS function in react-native-router-flux

To help you get started, we’ve selected a few react-native-router-flux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github steelx / react-native-redux-app / src / store / reducers / routes.reducer.js View on Github external
export default function routesReducer(state = initialState, action = {}) {
    switch (action.type) {
        // focus action is dispatched when a new screen comes into focus
        case ActionConst.FOCUS:
            console.log(action);
            return {
                ...state,
                scene: action.scene,
            };

        // ...other actions

        default:
            return state;
    }
}
github surmon-china / surmon.me.native / src.starter-kit.bak / redux / router / reducer.js View on Github external
export default function routerReducer(state = initialState, action) {
  switch (action.type) {
    // focus action is dispatched when a new screen comes into focus
    case ActionConst.FOCUS :
      return {
        ...state,
        scene: action.scene,
      };

    // ...other actions

    default :
      return state;
  }
}
github mcnamee / react-native-starter-kit / src / redux / router / reducer.js View on Github external
export default function routerReducer(state = initialState, action) {
  switch (action.type) {
    // focus action is dispatched when a new screen comes into focus
    case ActionConst.FOCUS :
      return {
        ...state,
        scene: action.scene,
      };

    // ...other actions

    default :
      return state;
  }
}
github N3TC4T / Nearby-Live / src / redux / core / router / reducer.js View on Github external
export default function routerReducer(state = initialState, action) {
    switch (action.type) {
    // focus action is dispatched when a new screen comes into focus
        case ActionConst.FOCUS:
            return {
                ...state,
                scene: action.scene
            };

            // ...other actions

        default:
            return state;
    }
}
github asrytis / dice-game / client / mobile / src / reducers / routes.js View on Github external
import { createReducer } from 'redux-create-reducer';
import { ActionConst } from 'react-native-router-flux';

const initialState = {
    scene: {},
};

export default createReducer(initialState, {
    // focus action is dispatched when a new screen comes into focus
    [ActionConst.FOCUS](state, action) {
        return {
            ...state,
            scene: action.scene,
        };
    },
});
github guangqiang-liu / OneM / src / reducers / common / router.js View on Github external
routerStack: [],
  eventUnit: []
}

const Actions= {}

Actions[type.REACT_NATIVE_ROUTER_FLUX_EVENT] = (state, action) => {
  if (action.payload.type) {
    return {
      ...state,
      eventUnit: ArrayTool.push(state.eventUnit, {type: action.payload.type, routeName: action.payload.routeName ? action.payload.routeName : 'back', params: action.payload.params})
    }
  }
}

Actions[ActionConst.FOCUS] = (state, action) => { // PUSH
  return {
    ...state,
    routerStack: [action.payload.routeName, ...state.routerStack], // 入栈
    eventUnit: []
  }
}

Actions[type.REACT_NATIVE_ROUTER_FLUX_BACK] = (state, action) => { // POP
  return {
    ...state,
    routerStack: [...ArrayTool.shift(state.routerStack)],
    eventUnit: []
  }
}

Actions[type.REACT_NATIVE_ROUTER_FLUX_EVENT_CLEAR] = (state, action) => {
github ant-design / ant-design-mobile / rn-kitchen-sink / index.js View on Github external
return (state, action) => {
    if (action.type === ActionConst.FOCUS && action.scene && action.scene.initial) {
      isMainScreen = true;
    } else {
      isMainScreen = false;
    }
    if (action.type === ActionConst.BACK_ACTION || action.type === ActionConst.BACK) {
      DeviceEventEmitter.emit('navigatorBack');
    }
    return defaultReducer(state, action);
  };
};
github EdgeApp / edge-react-gui / src / lib / routesReducer.js View on Github external
export default function reducer (state = initialState, action = {}) {
  switch (action.type) {
    case ActionConst.FOCUS: {
      const stackDepth =
      parseInt(action.scene.key.replace(action.scene.sceneKey, '').replace('_', ''))

      return {
        ...state,
        scene: action.scene,
        stackDepth: stackDepth
      }
    }
    default:
      return state
  }
}
github sobstel / sequent / src / reducers / routes.js View on Github external
export default function reducer (state = initialState, action = {}) {
  switch (action.type) {

    case ActionConst.FOCUS:
      return { ...state, scene: action.scene }
  }

  return state
}
github EdgeApp / edge-login-ui / src / web / lib / native / routesReducer.js View on Github external
export default function reducer (state = initialState, action = {}) {
  switch (action.type) {
    case ActionConst.FOCUS:
      return {
        ...state,
        scene: action.scene
      }

    default:
      return state
  }
}