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

fix: not working with styled-component

Open jjangga0214 opened this issue 4 months ago • 0 comments

Hi!

Condition

TextareaAutosize does not work when

  • styled-components wraps TextareaAutosize

AND

  • a state is used for value

Symptom

I can input a single letter, but not more.

Minimal Reproduction

'use client'

import TextareaAutosize from 'react-textarea-autosize'
import styled from 'styled-components'
import { useState } from 'react'

export default function Temp() {
  const [message, setMessage] = useState('')
  const Wrapper = styled.div``

  // When I remove either Wrapper or state, it works.
  return (
    <Wrapper> 
      <TextareaAutosize 
        value={message}
        onChange={(e) => setMessage(e.target.value)}
      />
    </Wrapper>
  )
}

Is this a bug, or is there a solution?

Thanks,

jjangga0214 avatar Oct 16 '24 04:10 jjangga0214