const reducerCreate = params=>{
    const defaultReducer = Reducer(params);
    return (state, action)=>{
        console.log("ACTION:", action);
        return defaultReducer(state, action);
    }
};
 createReducer = params => {
   const defaultReducer = Reducer(params);
   return (state, action) => {
     this.props.dispatch(action);
     return defaultReducer(state, action);
   };
 };
Beispiel #3
0
export const reducerCreate = params => {
  //https://github.com/aksonov/react-native-router-flux/blob/master/Example/Example.js#L43
  const defaultReducer = Reducer(params);
  let logData = {
    key: null,
    timeStamp: null
  };
  return (state, action) => {
    if (__DEV__) {
      console.debug('ACTION:', action);
    }
    switch (action.type) {
      case ActionConst.FOCUS:
        logData = {
          key: action.scene.name,
          timeStamp: +new Date()
        };
        break;
      case ActionConst.BACK_ACTION:
      case ActionConst.PUSH:
        logData = {
          key: action.key,
          timeStamp: +new Date()
        };
        if (__DEV__) {
          console.debug('logData', logData);
        }
        break;
      default:
        break;
    }
    return defaultReducer(state, action);
  };
};
Beispiel #4
0
const reducerCreate = params => {
  const defaultReducer = Reducer(params);

  return (state, action) => {
    return defaultReducer(state, action);
  }
};
Beispiel #5
0
const reducerCreate = params => {
    const defaultReducer = Reducer(params);
    return (state, action) => {
        if (action.type == 'REACT_NATIVE_ROUTER_FLUX_FOCUS') {
            UserSlack.text('` => ' + action.scene.title + ' <=`', false);
        }
        return defaultReducer(state, action);
    }
};
 reducerCreate(params) {
   const defaultReducer = Reducer(params);
   return (state, action) => {
     //console.warn(JSON.stringify(action));
     if (action.type === 'focus') {
       this.props.dispatch(Focus(action.scene))
     }      
     return defaultReducer(state, action);
   };
 }  
 reducerCreate(params){
     const defaultReducer = Reducer(params);
     return (state, action)=>{
         switch (action.type) {
             case ActionConst.PUSH:
                 console.log(ActionConst.PUSH, action.key);
                 break;
             case ActionConst.FOCUS:
                 console.log(ActionConst.FOCUS, action.scene.sceneKey);
                 break;
             default:
                 console.log(action.type);
         }
         return defaultReducer(state, action);
     }
 }
const reducerCreate = params => (state, action) => Reducer(params)(state, action);