【问题标题】:Custom control width when flex css style used使用 flex css 样式时的自定义控件宽度
【发布时间】:2021-12-16 06:07:46
【问题描述】:

我自定义的控件有一个文本框和文本框旁边的图标

return (
  <div className="useFlex">
    <TextInput></TextInput>
    <div>
      <Icon></Icon>
    </div>
  </div>
);

风格

.useFlex {
  display: flex;
}

效果很好

但问题是:当我在我的页面中使用这个自定义控件时,文本框宽度没有得到扩展并且它保持固定。

<Table width="100%">
   <tr>
      <td><MyCustomControl> </MyCustomControl></td>
   </tr>
</Table>

你能告诉我我在这里缺少什么吗?

【问题讨论】:

    标签: css reactjs react-native


    【解决方案1】:

    尝试添加

    .useFlex
    {
       display:flex;
       flex-grow: 1;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-14
      • 2011-01-29
      • 1970-01-01
      • 2015-05-26
      • 1970-01-01
      • 1970-01-01
      • 2010-09-09
      • 2023-04-04
      相关资源
      最近更新 更多