2016-07-27 180 views
2

react-native NavigatorIOS rightButton無法點擊。react-native NavigatorIOS rightButton無法點擊

onRightButtonPress: function(){ 

    this.refs.nav.push({ 
     title: 'From Right', 
     component: DetailViewController, 
    }) 
    }, 

沒有發生,當我點擊rightButton

render() { 
    return (
     <NavigatorIOS ref="nav" 

     initialRoute={{ 
      component: HomeScene,  
      title: 'NavigatorIOS Demo..', 
      rightButtonTitle: 'MORE!', 
      onRightButtonPress: this.onRightButtonPress, 

      leftButtonTitle:'leftItem', 
     }}> 
     </NavigatorIOS> 
    ); 
    }, 
}); 

回答

0

您需要方法綁定(),以 '本'。 或者改爲使用=>符號來定義方法。