jjzjj

ios - react-native NavigatorIOS rightButton 无法点击

coder 2024-01-30 原文

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>
    );
  },
});

最佳答案

您需要将方法 bind() 到“this”。 或者,使用 => 符号来定义方法。

关于ios - react-native NavigatorIOS rightButton 无法点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38609443/

有关ios - react-native NavigatorIOS rightButton 无法点击的更多相关文章

随机推荐