react-navigation, dispatch action to change scene - scene not showing -


i have setup substeps navigator below, first scene, pcdrinkingdays works fine. however, when click dispatch action, component change scene:

 ondone = () => {     this.props.dispatch(navigate(scenes.pc_help_me_calculate));   };` 

the pchelpmecalculate, doesn't appear, although can see renders in background setting breakpoints.

my navigator below. other scenes seem ok, moving first scene seems problem. can help? why isnt component showing?

import { substepsnavigator } '../../../navigators';  import pcdrinkingdays '../pcdrinkingdays'; import pchelpmecalculate '../pchelpmecalculate'; import pcunitscalculatorwhat '../pcunitscalculatorwhat'; import pcunitscalculatorsize '../pcunitscalculatorsize'; import pcunitscalculatorstrength '../pcunitscalculatorstrength'; import pcunitscalculatordrinksnumber '../pcunitscalculatordrinksnumber'; import pcunitscalculatortable '../pcunitscalculatortable';  import * scenes '../../../scenes';  const pcdrinkingscenes = {   [scenes.pc_drinking_days]: { screen: pcdrinkingdays },   [scenes.pc_help_me_calculate]: { screen: pchelpmecalculate },   [scenes.pc_units_calculator_what]: { screen: pcunitscalculatorwhat },   [scenes.pc_units_calculator_size]: { screen: pcunitscalculatorsize },   [scenes.pc_units_calculator_strength]: { screen: pcunitscalculatorstrength },   [scenes.pc_units_calculator_drinks_number]: {     screen: pcunitscalculatordrinksnumber,   },   [scenes.pc_units_calculator_table]: { screen: pcunitscalculatortable }, };  function getstep(routename) {   switch (routename) {     case scenes.pc_drinking_days:     case scenes.pc_help_me_calculate:     case scenes.pc_units_calculator_what:     case scenes.pc_units_calculator_size:     case scenes.pc_units_calculator_strength:     case scenes.pc_units_calculator_drinks_number:     case scenes.pc_units_calculator_table:       return 1;     default:       console.log(`err not found step route ${routename}`);       return -1;   } }  const stepsoptions = {   nsteps: 2,   getstep, };  const pcdrinkingnavigator = substepsnavigator(   pcdrinkingscenes,   { navigationoptions: { gesturesenabled: false }, headermode: 'none' },   stepsoptions );  export default pcdrinkingnavigator; 

i dispatch action in component:

class pcdrinkingdays extends component {    ondone = () => {     this.props.dispatch(navigate(scenes.pc_help_me_calculate));   };    render() {     return (       <sceneselectnumber         goback={this.goback}         onchangenumber={this.onchangenumber}         selectednumbervalue={this.props.daysinaweek}         ondone={this.ondone}         sceneconfig={sceneconfig}       />     );   } } 

you seem dispatch action nowhere. should use

this.props.navigation.dispatch(navigate(scenes.pc_help_me_calculate)); 

or use

this.props.navigation.navigate(scenes.pc_help_me_calculate); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -