滑块左菜单按钮不显示

时间:2018-12-10 12:23:44

标签: reactjs react-native

我正在创建Slider Drawer。工作正常。我有两个问题。左菜单中发生切换的文本不显示。因此Toggle无法正常工作。 其次,我想删除抽屉上的导航栏标题。这是我的代码,请帮助

import { createStackNavigator  , createDrawerNavigator ,createAppContainer} from 'react-navigation';
    import Home from './Home.js';
    import Drawer from './Drawer.js';
    import Detail from './Detail.js';
    import { DrawerActions } from 'react-navigation';

    const DrawerNavigator = createDrawerNavigator({
        Home:{
            screen: Home
        }
    },{
        initialRouteName: 'Home',
        contentComponent: Drawer,
        drawerWidth: 200
    });

    const StackNavigator = createStackNavigator({
       DrawerNavigator: { screen: DrawerNavigator },


    {
        navigationOptions: ({ navigation }) => ({
            title: 'ReactNavigation',  // Title to appear in status bar
            headerLeft: 
            <TouchableOpacity  onPress={() => {navigation.dispatch(DrawerActions.toggleDrawer())} }>
                <Text> hi </Text>
            </TouchableOpacity>,
            headerStyle: {
                backgroundColor: '#333',
            },
            headerTintColor: '#fff',
            headerTitleStyle: {
              fontWeight: 'bold',
            },

        })




       Detail: { screen: Detail },

    });

    export default createAppContainer(StackNavigator);

0 个答案:

没有答案