Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 反应本机对齐项目:基线不工作_Reactjs_React Native - Fatal编程技术网

Reactjs 反应本机对齐项目:基线不工作

Reactjs 反应本机对齐项目:基线不工作,reactjs,react-native,Reactjs,React Native,我需要将2个svg图标和一个带有一些文本的视图与基线对齐,但正如您从快照中看到的,它不起作用。 这是我想要的结果: 代码如下: <View style={styles.header}> <TouchableOpacity onPress={() => navigation.openDrawer()} style={{marginRight: 20}}> <MenuIcon /> </Touch

我需要将2个svg图标和一个带有一些文本的视图与基线对齐,但正如您从快照中看到的,它不起作用。

这是我想要的结果:

代码如下:

<View style={styles.header}>
        <TouchableOpacity onPress={() => navigation.openDrawer()} style={{marginRight: 20}}>
          <MenuIcon />
        </TouchableOpacity>
        <View>
          <Text style={styles.date}>24 ottobre 2019</Text>
          <Text style={styles.title}>Compiti</Text>
        </View>
        <TouchableOpacity onPress={() => navigation.navigate({routeName: 'Calendary'})} style={{position: 'absolute', right:0}}>
          <CalendarIcon width={50} height={50} />
        </TouchableOpacity>
    </View>

您的
标题
样式应如下所示:

header: {
    flex: 1,
    flexDirection: 'row',
    alignItems: 'center', // add center instead of flex-end
}

我希望它处于基线,而不是中间
header: {
    flex: 1,
    flexDirection: 'row',
    alignItems: 'center', // add center instead of flex-end
}