react native react-navigation V2不显示屏幕标题

时间:2018-05-24 06:07:45

标签: reactjs react-native react-navigation

我最近在反应原生应用中使用了React导航我更新了反应导航1. *到2. *现在我使用 createBottomTabNavigator

后屏幕标题没有显示

这是我在HomeScreen中的代码

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")}
    />
  )
}

}

1 个答案:

答案 0 :(得分:0)

尝试使用此代码:

{
            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,
                        }]
                    }
                } 
            }
          }