Byteclaw/visage

[TextArea] - when controlled by react-hook-form controller doesn't react correctly to onChange with autoResize is enabled

michalkvasnicak opened this issue · 1 comments

Following code causes TextArea to be slow or to ignore the input.

<Controller
        defaultValue=""
        name="description"
        onFocus={() => inputRef.current?.focus()}
        render={({ onBlur, onChange, value }) => (
          <>
            <TextArea
              invalid={!!form.errors?.title}
              autoResize
              id="offer-description"
              name="description"
              onBlur={onBlur}
              onChange={(e) => onChange(e.currentTarget.value)}
              maxLength={800}
              ref={inputRef}
              rows={10}
              required
              value={value}
            />
            <Box>
              <SmallText>{800 - value.length}</SmallText>
            </Box>
          </>
        )}
      />

When autoResize is removed, then it works correctly.