【发布时间】:2021-09-06 20:38:14
【问题描述】:
我正在使用 flex 在 react-native 上进行响应式设计
<View
style={{
flexDirection: 'row',
alignItems: 'center',
flexWrap: 'wrap',
justifyContent: 'space-between',
paddingHorizontal: 10
}}>
<View style={{ flex: 0, backgroundColor: 'red'}}>
<Text style={{ fontSize: 22 }}>
{ moment().format('LL') }
</Text>
</View>
<View style={{flex: 0, backgroundColor: 'blue'}}>
<Text style={{ fontSize: 22,flex: 1, alignSelf: 'flex-end'}}>
# 123123123123123
</Text>
</View>
</View>
蓝色组件溢出容器。
但是,当我从样式中删除 alignItems: center 时。
它工作正常。
还有其他解决方案或解决方法吗? 谢谢!
【问题讨论】:
标签: react-native flexbox stylesheet