如何在同一屏幕上使用“底部标签”和“抽屉”导航器

时间:2020-06-15 13:14:48

标签: react-native react-navigation

问题:

我已经创建了这样的“抽屉”导航。

import * as React from 'react';
import {createDrawerNavigator} from '@react-navigation/drawer';
import ExistingPatientNavigator from '_navigations/ExistingPatientNavigator';

const Drawer = createDrawerNavigator();

export default () => (
  <Drawer.Navigator initialRouteName="existingPatientHome">
    <Drawer.Screen
      name="existingPatientHome"
      component={ExistingPatientNavigator}
      options={{
        headerShown: true,
      }}
    />
  </Drawer.Navigator>
);

ExistingPatientNavigator代码是这样的。

import * as React from 'react';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import AssetmentStackNavigator from '_navigations/AssestmentStackNavigator';

const Tab = createBottomTabNavigator();

export default () => (
  <Tab.Navigator>
    <Tab.Screen name="assetsment" component={AssetmentStackNavigator} />
  </Tab.Navigator>
);

这是我的评估堆栈导航器。

import * as React from 'react';
import {createStackNavigator} from '@react-navigation/stack';
import ExistingPatientHomeScreen from '_screens/existingPatientHome';
import HeaderTitle from '_components/headerTitle';
import normalize from '_utils/fontsize';
import Icon from 'react-native-vector-icons/FontAwesome';

const AssestmentStack = createStackNavigator();

export default () => {
  <AssestmentStack.Navigator initialRouteName="assestments">
    <AssestmentStack.Screen
      name="assestments"
      component={ExistingPatientHomeScreen}
      options={{
        headerShown: true,
        headerLeft: () => (
          <Icon name="align-left" size={normalize(13)} color="#aaaaaa" />
        ),
        headerTitleAlign: 'center',
        headerTitle: () => <HeaderTitle title={'Explore'} />,
        headerStyle: {backgroundColor: '#f2f2f2'},
        headerTransparent: false,
      }}
    />
  </AssestmentStack.Navigator>;
};

这给我一个

的错误

default()渲染未返回任何内容。这通常意味着 返回语句丢失。或者,不渲染任何内容,则返回null

有人可以帮助我解决此问题吗?我也想知道如何打开抽屉式导航器以及如何对它进行定制设计。而且,我还想知道如何将自定义设计放入选项卡导航器菜单,因为我对此还不了解。

0 个答案:

没有答案