简体   繁体   English

如何编辑 -add 字符串和图标之间的边距? 反应原生 - 抽屉

[英]How can I edit -add margin between the string and the icon? REACT-NATIVE - DRAWER

Im building a sidebar menu, and im using react-navigation-drawer , heres the code:我正在构建一个侧边栏菜单,并使用react-navigation-drawer ,代码如下:

    const drawer = createDrawerNavigator({ //hooks
            Home: { screen: Home_Stack, navigationOptions: {drawerIcon: <Entypo name = "home" size = {24} color = {"black"}></Entypo>}},
            About: { screen: Slide_menu_stack}
    });

    export default createAppContainer(drawer);

and it looks like this:它看起来像这样:

在此处输入图片说明

I want home to be more closer to the icon, how can I do that?我想让家更接近图标,我该怎么做?

you can create a custom drawer component like think你可以创建一个自定义的抽屉组件,比如 think

import { NavigationContainer } from '@react-navigation/native';
import {createDrawerNavigator,} from '@react-navigation/drawer'; 
const Drawer = createDrawerNavigator();

export function MyDrawer() {
 return (
<NavigationContainer>
<Drawer.Navigator drawerContent={props => <CustomDrawerContent {...props} />}>

  <Drawer.Screen name="Home" component={Home_Stack} />
  <Drawer.Screen name="About" component={Slide_menu_stack} />

</Drawer.Navigator>
</NavigationContainer>
);
}

and coustomdrawer like this which I created和我创造的这样的coustomdrawer

function CustomDrawerContent(props) {

  return (
    <View style={styles.container}>
      <ScrollView>
        {here you can style your drawer as you want}
      </ScrollView>
    </View>
  )
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM