在导航栏中显示标题和图像:react-native-router-flux

时间:2019-01-31 11:39:57

标签: react-native react-native-router-flux

我想在导航栏中显示图像和标题,但是使用下面的代码,一次只能实现一个。

下面的代码仅显示图像和汉堡图标

<Drawer
      hideNavBar
      key="drawerMenu"
      contentComponent={SideMenu}
      drawerWidth={250}
      drawerPosition="left">

      <Scene key="dashboard"
             component={Home}
             navigationBarTitleImage = {require('./images/logo.jpeg')}
             navigationBarTitleImageStyle = {{width:30, height:30}}
             title={"Dashboard"}/>
</Drawer>

输出:enter image description here

现在,当我注释navigationBarTitleImage时,只有标题可见,请在下面检查代码并输出

<Drawer
    hideNavBar
    key="drawerMenu"
    contentComponent={SideMenu}
    drawerWidth={250}
    drawerPosition="left">
          <Scene key="dashboard"
                 component={Home}
                 //navigationBarTitleImage = {require('./images/logo.jpeg')}
                 //navigationBarTitleImageStyle = {{width:30, height:30}}
                 title={"Dashboard"}/>

    </Drawer>

输出:enter image description here

我总共想要三件事:抽屉图标,自定义图标以及标题。谁能告诉我我的代码有什么问题吗?

1 个答案:

答案 0 :(得分:1)

只需使用navBar属性。它允许您渲染任何想要的东西。

请参见docs

相关问题