javascript - 弹性容器中的反应选择
问题描述
如何让 react-select 尊重 flex 布局?以下没有任何工作。
const Container = styled('div')`
width: 100%;
height: 100%;
display: flex;
flex-flow: row wrap;
justify-content: space-around;
align-items: baseline;
`;
const selectStyles = {
input: base => ({
minWidth: 200,
flex: 1,
<Container>
<Select
style={{ flex: 1 }}
styles={selectStyles}
解决方案
要使您的react-select
组件具有弹性,您需要flex:1
在容器上应用道具,如下所示:
const styles = {
container: base => ({
...base,
flex: 1
})
};
<Select styles={styles} />
推荐阅读
- r - 如何通过使用数据集中的 2 列来制作向量
- angular - 为什么 Angular 教程不更新 .subscribe() 中的英雄列表?
- android-studio - 在 Android Studio 编辑器或 IntelliJ IDEA 中更改字体
- sql - 使用联合连接两个表时,如何在 sql 中分别对两个表使用 order by 子句
- php - 如何从 JSON 数组中排除撇号?
- python - 无法使用 pip 安装 CuPy 和 PyTorch
- python - 如何通过一些修改将 xml 转换为字典?
- r - 将引导线添加到 ggplot2 饼图
- linq - 优化的 Linq IEnumerable 查询
- tkinter - 带有图标而不是文本的工具栏