我使用的是ReactNative,我使用的是native base和ReactNavigation npm.

我得到了这个,我的问题是,我如何能有一个标题,直到"主页"按钮,我查看了react-navigation 的文档,但它并没有真正清除.

https://github.com/react-community/react-navigation/blob/master/docs/api/navigators/DrawerNavigator.md

enter image description here

Like this (the image is fix, it's just to put a logo here)

enter image description here

推荐答案

您可以为抽屉实现自定义内容组件.在那里,你也可以简单地使用DrawerItems渲染导航项.例如:

import React from 'react'
import { Text, View } from 'react-native'
import { DrawerItems, DrawerNavigation } from 'react-navigation'

const DrawerContent = (props) => (
  <View>
    <View
      style={{
        backgroundColor: '#f50057',
        height: 140,
        alignItems: 'center',
        justifyContent: 'center',
      }}
    >
      <Text style={{ color: 'white', fontSize: 30 }}>
        Header
      </Text>
    </View>
    <DrawerItems {...props} />
  </View>
)

const Navigation = DrawerNavigator({
  // ... your screens
}, {
  // define customComponent here
  contentComponent: DrawerContent,
})

React-native相关问答推荐

ios 中节列表中的scrollToLocation 不起作用.在 Android 上,列表滚动回索引 0,但在 ios 上不会发生同样的情况

导航堆栈不显示

react-native useEffect / useFocusEffect / useCallback 没有正确更新

React Native Child Parent 通信

无法在 React Native iOS 模拟器中按 URI 显示图像

在 React Native Paper 中更改 TextInput 的文本 colored颜色

使用 AsyncStorage 如何以及在何处保存整个 redux 存储

如何更改 React Native(android)应用程序的远程推送通知图标

如何实时从 react-native-camera 获取帧

如何在 React Native For Android 中删除启动画面后的白屏

textAlignVertical不是有效的样式属性

如何在 react-native 上自动聚焦下一个 TextInput

React native Touch 事件正在通过绝对视图

词法或预处理器问题 - 未找到 event2/event-config.h 文件

使用 Jest 测试 React Native 应用程序

我可以从react-native元素中删除 tvOS 吗?

如何在样式组件之外获取主题?

React Native - __DEV__ 未定义

如何构建一个 react-native 应用程序,以便它在 ipad 上作为 ipad 应用程序运行?

使用行数react-native文本组件