2016-05-16 40 views
2

我有一個導航儀,顯示儀表板在反應母語我想這樣做poptoTop

<Navigator 
    ref="nav" 
    navigationBarHidden={true} 
    style={styles.container} 
    initialRoute={{name: 'dashboard'}} 
    renderScene={this.renderScene} 
    configureScene={() => { returnNavigator.SceneConfigs.PushFromRight; }} 
/> 

我能夠遞增和遞減一籃計數器這個網頁上購買產品後執行的組件的方法,我已經完成了購買產品後,我用

this.props.navigator.popToTop() 

回去,可惜櫃檯仍然是相同的,我怎麼能叫在錶盤的方法,當我回到它重置在籃下反或者我怎麼能再次調用componentDidMount?

回答

0

您需要使用另一個lifecycle method,例如componentWillReceivePropscomponentWillUpdate。如果這可以修復你的錯誤很難說,因爲你沒有提供足夠的代碼來理解你的應用程序正在發生什麼。