route.js
651 Bytes
import { ActionConst } from 'react-native-router-flux';
const initialState = {
scene: {},
lastPopScene: '',
};
export default function reducer(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,
};
case ActionConst.BACK_ACTION:
return {
...state,
lastPopScene: state.scene.sceneKey,
};
// ...other actions
default:
return state;
}
}