@@ -130,8 +130,8 @@ function NavigationStore(){var _this=this;_classCallCheck(this,NavigationStore);
130130
131131nextState = function ( state , cmd ) { return _this . reducer ?_this . reducer ( state , cmd ) :_this . _router . getStateForAction ( cmd , state ) ; } ; this .
132132
133- dispatch = function ( cmd , type ) {
134- _this . setState ( _this . nextState ( _this . state , cmd ) , type ) ;
133+ dispatch = function ( cmd , type , params ) {
134+ _this . setState ( _this . nextState ( _this . state , cmd ) , type , params ) ;
135135} ; _initDefineProp ( this , 'setState' , _descriptor4 , this ) ; this .
136136
137137
@@ -149,6 +149,9 @@ _this.setState(_this.nextState(_this.state,cmd),type);
149149
150150
151151
152+
153+
154+
152155run = function ( ) { for ( var _len = arguments . length , params = Array ( _len > 3 ?_len - 3 :0 ) , _key = 3 ; _key < _len ; _key ++ ) { params [ _key - 3 ] = arguments [ _key ] ; } var type = arguments . length > 0 && arguments [ 0 ] !== undefined ?arguments [ 0 ] :ActionConst . PUSH ; var routeName = arguments [ 1 ] ; var actions = arguments [ 2 ] ;
153156var res = { } ;
154157for ( var _iterator = params , _isArray = Array . isArray ( _iterator ) , _i = 0 , _iterator = _isArray ?_iterator :_iterator [ typeof Symbol === 'function' ?typeof Symbol === 'function' ?Symbol . iterator :'@@iterator' :'@@iterator' ] ( ) ; ; ) { var _ref ; if ( _isArray ) { if ( _i >= _iterator . length ) break ; _ref = _iterator [ _i ++ ] ; } else { _i = _iterator . next ( ) ; if ( _i . done ) break ; _ref = _i . value ; } var param = _ref ;
@@ -158,7 +161,7 @@ res=_extends({},res,filterParam(param));
158161}
159162res . routeName = routeName ;
160163if ( supportedActions [ type ] ) {
161- _this . dispatch ( createAction ( supportedActions [ type ] ) ( { routeName :routeName , index :0 , actions :actions , params :res } ) , type ) ;
164+ _this . dispatch ( createAction ( supportedActions [ type ] ) ( { routeName :routeName , index :0 , actions :actions , params :res } ) , type , res ) ;
162165} else if ( type === ActionConst . POP_TO ) {
163166var nextScene = '' ;
164167var newState = _this . _state ;
@@ -235,7 +238,7 @@ _this.run(ActionConst.REPLACE,routeName,[_reactNavigation.NavigationActions.navi
235238routeName :routeName ,
236239params :res } ) ] ) ;
237240
238- } ; var defaultSuccess = function defaultSuccess ( ) { } ; var defaultFailure = function defaultFailure ( ) { } ; ( 0 , _mobx . autorunAsync ) ( function _callee ( ) { var handler , res , _handler , success , failure , params , _res ; return regeneratorRuntime . async ( function _callee$ ( _context ) { while ( 1 ) { switch ( _context . prev = _context . next ) { case 0 :_context . prev = 0 ; if ( _this . prevScene && _this . currentScene !== _this . prevScene ) { handler = _this [ _this . prevScene + _Util . OnExit ] ; if ( handler ) { try { res = handler ( ) ; if ( res instanceof Promise ) { res . then ( defaultSuccess , defaultFailure ) ; } } catch ( e ) { console . error ( 'Error during onExit handler:' , e ) ; } } } if ( ! ( _this . currentScene && _this . currentScene !== _this . prevScene && _this . states [ _this . currentScene ] ) ) { _context . next = 20 ; break ; } _handler = _this [ _this . currentScene + _Util . OnEnter ] ; success = _this . states [ _this . currentScene ] . success || defaultSuccess ; failure = _this . states [ _this . currentScene ] . failure || defaultFailure ; if ( ! _handler ) { _context . next = 20 ; break ; } _context . prev = 7 ; params = _this . currentState ( ) . params ; console . log ( 'RUN onEnter handler for state=' , _this . currentScene , ' params=' + JSON . stringify ( params ) ) ; _context . next = 12 ; return regeneratorRuntime . awrap ( _handler ( params ) ) ; case 12 :_res = _context . sent ; if ( _res ) { console . log ( 'SUCCESS' , _res ) ; success ( _res ) ; } else { console . log ( 'FAILURE NULL RES' ) ; failure ( ) ; } _context . next = 20 ; break ; case 16 :_context . prev = 16 ; _context . t0 = _context [ 'catch' ] ( 7 ) ; console . log ( 'FAILURE EXCEPTION' , _context . t0 ) ; failure ( _context . t0 ) ; case 20 :_context . next = 25 ; break ; case 22 :_context . prev = 22 ; _context . t1 = _context [ 'catch' ] ( 0 ) ; console . error ( 'Error handling:' + _context . t1 ) ; case 25 :case 'end' :return _context . stop ( ) ; } } } , null , _this , [ [ 0 , 22 ] , [ 7 , 16 ] ] ) ; } ) ; } return NavigationStore ; } ( ) , ( _descriptor = _applyDecoratedDescriptor ( _class . prototype , 'currentScene' , [ _mobx . observable ] , { enumerable :true , initializer :function initializer ( ) { return '' ; } } ) , _descriptor2 = _applyDecoratedDescriptor ( _class . prototype , 'prevScene' , [ _mobx . observable ] , { enumerable :true , initializer :function initializer ( ) { return '' ; } } ) , _descriptor3 = _applyDecoratedDescriptor ( _class . prototype , 'currentParams' , [ _mobx . observable ] , { enumerable :true , initializer :null } ) , _descriptor4 = _applyDecoratedDescriptor ( _class . prototype , 'setState' , [ _mobx . action ] , { enumerable :true , initializer :function initializer ( ) { var _this2 = this ; return function ( newState , type ) { if ( ! newState ) { return ; } var state = _this2 . currentState ( newState ) ; if ( type === ActionConst . JUMP && state . routeName === _this2 . currentScene ) { return ; } _this2 . _state = newState ; _this2 . prevScene = _this2 . currentScene ; _this2 . currentScene = state . routeName ; _this2 . currentParams = state . params ; } ; } } ) ) , _class ) ; exports . default =
241+ } ; var defaultSuccess = function defaultSuccess ( ) { } ; var defaultFailure = function defaultFailure ( ) { } ; ( 0 , _mobx . autorunAsync ) ( function _callee ( ) { var handler , res , _handler , success , failure , params , _res ; return regeneratorRuntime . async ( function _callee$ ( _context ) { while ( 1 ) { switch ( _context . prev = _context . next ) { case 0 :_context . prev = 0 ; if ( _this . prevScene && _this . currentScene !== _this . prevScene ) { handler = _this [ _this . prevScene + _Util . OnExit ] ; if ( handler ) { try { res = handler ( ) ; if ( res instanceof Promise ) { res . then ( defaultSuccess , defaultFailure ) ; } } catch ( e ) { console . error ( 'Error during onExit handler:' , e ) ; } } } if ( ! ( _this . currentScene && _this . currentScene !== _this . prevScene && _this . states [ _this . currentScene ] ) ) { _context . next = 20 ; break ; } _handler = _this [ _this . currentScene + _Util . OnEnter ] ; success = _this . states [ _this . currentScene ] . success || defaultSuccess ; failure = _this . states [ _this . currentScene ] . failure || defaultFailure ; if ( ! _handler ) { _context . next = 20 ; break ; } _context . prev = 7 ; params = _this . currentState ( ) . params ; console . log ( 'RUN onEnter handler for state=' , _this . currentScene , ' params=' + JSON . stringify ( params ) ) ; _context . next = 12 ; return regeneratorRuntime . awrap ( _handler ( params ) ) ; case 12 :_res = _context . sent ; if ( _res ) { console . log ( 'SUCCESS' , _res ) ; success ( _res ) ; } else { console . log ( 'FAILURE NULL RES' ) ; failure ( ) ; } _context . next = 20 ; break ; case 16 :_context . prev = 16 ; _context . t0 = _context [ 'catch' ] ( 7 ) ; console . log ( 'FAILURE EXCEPTION' , _context . t0 ) ; failure ( { error :_context . t0 } ) ; case 20 :_context . next = 25 ; break ; case 22 :_context . prev = 22 ; _context . t1 = _context [ 'catch' ] ( 0 ) ; console . error ( 'Error handling:' + _context . t1 ) ; case 25 :case 'end' :return _context . stop ( ) ; } } } , null , _this , [ [ 0 , 22 ] , [ 7 , 16 ] ] ) ; } ) ; } return NavigationStore ; } ( ) , ( _descriptor = _applyDecoratedDescriptor ( _class . prototype , 'currentScene' , [ _mobx . observable ] , { enumerable :true , initializer :function initializer ( ) { return '' ; } } ) , _descriptor2 = _applyDecoratedDescriptor ( _class . prototype , 'prevScene' , [ _mobx . observable ] , { enumerable :true , initializer :function initializer ( ) { return '' ; } } ) , _descriptor3 = _applyDecoratedDescriptor ( _class . prototype , 'currentParams' , [ _mobx . observable ] , { enumerable :true , initializer :null } ) , _descriptor4 = _applyDecoratedDescriptor ( _class . prototype , 'setState' , [ _mobx . action ] , { enumerable :true , initializer :function initializer ( ) { var _this2 = this ; return function ( newState , type , params ) { if ( ! newState ) { return ; } var state = _this2 . currentState ( newState ) ; if ( type === ActionConst . JUMP && state . routeName === _this2 . currentScene ) { return ; } _this2 . _state = newState ; _this2 . prevScene = _this2 . currentScene ; _this2 . currentScene = state . routeName ; _this2 . currentParams = state . params ; if ( type === ActionConst . JUMP && params ) { _this2 . refresh ( params ) ; } } ; } } ) ) , _class ) ; exports . default =
239242
240243
241244
0 commit comments