react-native-router-flux: Actions.KEY doesn't work inside function that is passed to onPress -


i have following code:

_rendermenuitem(name) {     return (         <touchablehighlight onpress={() => this._onitemclicked(name) }>             <text>{name}</text>         </touchablehighlight>     ) }  _onitemclicked(name) {     actions.categoryscreen()     this.props.dispatch(updateactivepage(name))      // close navigationdrawer     actions.refresh({ key: 'drawer', open: false }) } 

the actions.refresh() works fine actions.categoryscreen() doesn't -looks nothing happens. if replace parameter passed onpress onpress={actions.categoryscreen} works fine , categoryscreen shown. however, not me cause there more stuff want when onpress triggered , need pass 'name' parameter.

any ideas, anyone?

thanks in advance.

i found solution this reported issue on react-native-router-flux's repository. there seems bug when 2 actions triggered 1 after other, second 1 works. workaround people posted , worked me trigger second action timeout. works if timeout 0. here's how _onitemclicked looks now:

_onitemclicked(name) {     actions.categoryscreen()     this.props.dispatch(updateactivepage(name))      // close navigationdrawer.      settimeout(() => actions.refresh({ key: 'drawer', open: false }), 0) } 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -