弹性容器中的反应-select
react-select in flex container
如何让 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} />
如何让 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} />