问题
How can I make react-select to respect flex layout? Nothing of the below worked.
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}
回答1:
To make your react-select
component flex you need to apply flex:1
props on the container like this:
const styles = {
container: base => ({
...base,
flex: 1
})
};
<Select styles={styles} />
来源:https://stackoverflow.com/questions/54234709/react-select-in-flex-container