Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: not working with styled-component #399

Open
jjangga0214 opened this issue Oct 16, 2024 · 0 comments
Open

fix: not working with styled-component #399

jjangga0214 opened this issue Oct 16, 2024 · 0 comments

Comments

@jjangga0214
Copy link

jjangga0214 commented Oct 16, 2024

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant