【发布时间】:2019-12-16 12:08:37
【问题描述】:
我正在使用 react-select 3.0.8 和 styled-components 4.3.2,但是当我设置高度时,它显示为背景中的高度,而不是更改输入高度。
const SearchInput = styled(Select)`
height: 90px;
width: 590px;
background: blue;
border: none;
font-family: "Monserrat", sans-serif;
font-weight: medium;
box-shadow: 0 1px 4px #444;
border-radius: 4px;
font-size: 22px;
outline: none;
`;
....
<SearchInput
value={selected}
options={options}
placeholder="Search a city"
isSearchable="true"
components={{ DropdownIndicator:() => null,
IndicatorSeparator:() => null }}
/>
【问题讨论】:
-
你确定 react-select 没有一些你设计的没有输入的包装器吗?
-
不,它没有。
-
是的,在 api 或这里查看:github.com/JedWatson/react-select/issues/1322
-
我看过这个文档,但没有一个涉及样式组件。这让我有点困惑。
-
你不能用 styled-components 设置这个组件的样式。使用你的组件 api。
标签: reactjs styled-components react-select