弹性容器中的反应选择

Yuk*_*uki 3 javascript flexbox reactjs react-select

如何让 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}
Run Code Online (Sandbox Code Playgroud)

Lau*_*ura 9

为了让你的react-select组件灵活,你需要flex:1像这样在容器上应用props:

const styles = {
  container: base => ({
    ...base,
    flex: 1
  })
};

<Select styles={styles} />
Run Code Online (Sandbox Code Playgroud)