簡體   English   中英

react native導航V2未顯示屏幕標題

[英]react native react-navigation V2 Not showing Screen header

我最近在react native應用程序中使用了React導航我將react-navigation 1. *更新為2. *現在使用createBottomTabNavigator后屏幕標題未顯示

這是我的主屏幕中的代碼

static navigationOptions =({navigation})=> {


return {
  headerTitle: <Logo type="default_logo" />,
  headerTitleStyle: { alignItems: "center" },
  headerStyle: {
    paddingRight: 10,
    paddingLeft: 10
  },
  headerLeft: (
    <ClickableIcon
      source={NotificationInactive}
      height={35}
      width={35}
      onIconPressed={() => alert("Notifications Clicked")}
    />
  ),
  headerRight: (
    <ClickableIcon
      height={35}
      width={35}
      source={AddNewUserInactive}
      onIconPressed={() => alert("Add New Clicked")}
    />
  )
}

}

嘗試使用以下代碼:

{
            stack: {
                children: [
                    {
                        component: {
                            name: 'demoApplication.NewsListScreen',  //tab component
                        }
                    }
                ],
                options: {           // try options for topbar and bottom tabs       
                    bottomTab: {
                        text: 'Users',
                        icon: require('../../assets/images/two.png')
                    },
                    topBar: {
                        drawBehind: false,
                        background: {
                            color: 'transparent'
                        },
                        title: {    // Title can be used as text or component
                            component: {
                                id: "LogoComponent",
                                name: 'app.LogoComponent',
                                alignment: 'center'
                            }
                            // text:"title"
                        },
                        leftButtons: [{
                            icon: require("../../assets/images/one.png"),
                            id: "left",
                            enabled: true,
                            buttonColor: "green",
                            color:"red",
                            disableIconTint: true,
                        }],
                        rightButtons: [{
                            icon: require("../../assets/images/two.png"),
                            id: 'right',
                            enabled: true,
                            buttonColor: "#green",
                            color:"red",
                            disableIconTint: true,
                        }]
                    }
                } 
            }
          }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM