相关疑难解决方法(0)

React Native flex-box对齐图标和文本

react native应用程序中,我使用'react-native-vector-icons/MaterialIcons'.

我试着<用一些文字按钮.不幸的是,<图标未与文本对齐.文本与< 底部对齐而不是中间对齐在同一行.

我没有flex: 1.代码已更新.

我的代码

    <TouchableOpacity style={styles.navBarLeftButton}>
       <Icon name="chevron-left" />
       <Text style={styles.buttonText}>My Button</Text>
    </TouchableOpacity>
Run Code Online (Sandbox Code Playgroud)

我的风格

    navBarLeftButton: {
      flex: 1,
      flexDirection: 'row',
      alignItems: 'center',
      justifyContent: 'flex-start'
      width: 100,
      paddingLeft: 8
    }

    buttonText: {
      color: 'rgba(255,255,255,0.70)',
      fontSize: 14
    }
Run Code Online (Sandbox Code Playgroud)

icons flexbox react-native

10
推荐指数
2
解决办法
2万
查看次数

标签 统计

flexbox ×1

icons ×1

react-native ×1