react-input-autosize icon indicating copy to clipboard operation
react-input-autosize copied to clipboard

MinWidth is set to 1 even placeholder is passed down

Open thomaslc66 opened this issue 6 years ago • 0 comments

I encountered some issue with the placeholder size and the minWidth.

Some of my input have on render, a minWidth={1}, causing inputWidth also been equal to 1. I have i icon in the same component to copy what's inside the input, and when i pass on this icon it trigger a re-render and then the inputWidth pass to 41, displaying all the content.

If i wan't something correct i have to set my Autosize component with minWidth like this:

        <AutosizeInput
          className={touched && error ? 'list_input_error' : 'list_input'}
          disabled={status}
          onClick={onClick}
          value={text}
          name={name}
          onChange={onChange}
          minWidth={text ? text.length * 8 : placeholder.length * 8}
          placeholder={placeholder}
        />

For context purpose and if you want to reproduce. I use the @bluprintjs/core Tabs element with two tabs. And this behaviour only happend on the AutosizeInput that are on the second tabs.

But the real question is WHY?

thomaslc66 avatar May 16 '19 18:05 thomaslc66