简体   繁体   English

如何在 React Native 中向 NavigatorIOS 添加右键?

[英]How do I add a right button to NavigatorIOS in React Native?

Trying to get NavigatorIOS working in React Native but I'm having trouble getting a button to show up on the right.试图让 NavigatorIOS 在 React Native 中工作,但我无法让按钮显示在右侧。 I'm calling this this block of code when the user successfully logs in using Facebook API:当用户使用 Facebook API 成功登录时,我将此代码块称为:

this.props.navigator.replace({
      title:"Agni", 
      component: SwipeScreen,
      rightButtonTitle: 'Matches',
      onRightButtonPress: () => { console.log("matches") },
      passProps:{'token': {result: info}},
    });

Does calling .replace intead of .push have anything to do with why it won't show up?调用 .replace 而不是 .push 是否与为什么它不会出现有关?

Thanks.谢谢。

I was able to get my rightButtonTitle to appear when using this.props.navigator.push() as opposed to this.props.navigator.replace() .使用this.props.navigator.push()而不是this.props.navigator.replace()时,我能够让我的rightButtonTitle出现。

On the React Native's Github Issues page, this issue is exactly what you're experiencing.在 React Native 的 Github 问题页面上,这个问题正是您所遇到的。 The last comment, from 25 days ago, also states that replace suffers from this same issue. 25 天前的最后一条评论也指出, replace也存在同样的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM