react-textarea-autosize
react-textarea-autosize copied to clipboard
fix: not working with styled-component
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,