headerRight以毫秒显示,然后消失。 (反应导航)

时间:2017-10-13 12:35:11

标签: reactjs react-native react-navigation

我正在使用Kitten UI进行导航(它只是包装)。 我可以呈现- (nullable WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures { WKWebView *childWebView = [[WKWebView alloc] initWithFrame:CGFrameZero configuration:configuration]; WebViewController *webViewController = [[WebViewController alloc] initWithWebView: childWebView]; // looks like this is no longer required, but I can't check it now :( // [childWebView loadRequest:navigationAction.request]; // Show controller without interfering the current flow of API call, thus dispatch after a fraction of second dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self.navigationController pushViewController:webViewController animated:YES]; }); return childWebView; } title,但headerLeft不会显示。 (图片附在这个问题的最底部)

这是navBar.js(ThemedNavigationBar)

headerRight

这是我的ChangePassword的navigationOption

_renderRight(headerRight) {
    let windowWidth = Dimensions.get('window').width;
    const width = this.state.width
      ? (windowWidth - this.state.width) / 2
      : undefined;
    return headerRight && (
        <View style={[{width}, styles.right]}>{headerRight}</View>
      );

  }

render() {
    let options = this.props.headerProps.getScreenDetails(this.props.headerProps.scene).options;
    return (
      <View style={styles.layout}>
        <View style={styles.container}>
          {this._renderTitle(options.title, options.headerTitle)}
          {this._renderLeft(options.headerLeft)}
          {this._renderRight(options.headerRight)}
        </View>
      </View>
    )
  }

static navigationOptions = ({ navigation }) => ({ title: `Change Password`, tabBarVisible: false, headerRight: ( <- RIGHT HERE <Button title='SAVE' /> ), header: (headerProps) => { return <ThemedNavigationBar navigation={navigation} headerProps={headerProps}/> } }); 没有出现!

enter image description here

更新

enter image description here

当我将<Button title='SAVE' />从0设置为30时,我得到了这种奇怪的导航。这里发生了什么?

styles.right.right

1 个答案:

答案 0 :(得分:0)

设置宽度a= list(set([1,2,3,4])) print(a(1)) # wrong! Use [] 的确切值解决了我的问题!谢谢你们