【发布时间】:2021-05-26 03:21:45
【问题描述】:
背景
我有这个代码,连续 3 个块。由于第二个块,该行的高度为 100px。 我希望第三个(钢蓝)块的底部与中间较大块的底部对齐。 现在,我只能让方块顶部对齐。
问题
如何让视图与比实际高的行的底部对齐?
到目前为止的代码
import React from 'react';
import { View } from 'react-native';
const JustifyContentBasics = () => {
return (
<View style={{
flex: 1,
flexDirection: 'row',
justifyContent: 'space-between',
}}>
<View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
<View style={{width: 100, height: 100, backgroundColor: 'skyblue'}} />
<View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
</View>
);
};
export default JustifyContentBasics;
https://snack.expo.io/oQXyEEikE
我的尝试
我曾尝试用 div 包裹钢蓝方块,但无济于事。
<div style={{
flex: 1,
flexDirection: 'column',
justifyContent: 'flex-end'}}>
<View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
</div>
【问题讨论】:
标签: css reactjs react-native flexbox