We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am using it like this:
<Textarea autoFocus placeholder={(formState.commentBody && formState.commentBody !== '') ? formState.commentBody : intl.get('issue_details_placeholder_add_a_comment')} value={formState.commentBody} onChange={handleChange('commentBody')} ref={$textareaRef} />
what gets displayed in the textarea is just formState.commentBody and Textarea is defined as:
formState.commentBody
Textarea
import React, { forwardRef } from 'react'; import TextareaAutoSize from 'react-textarea-autosize'; import { StyledTextarea } from './Styles'; const Textarea = forwardRef(({ className, invalid, onChange, ...textareaProps }, ref) => ( <StyledTextarea className={className} invalid={invalid}> <TextareaAutoSize {...textareaProps} onChange={event => onChange(event.target.value, event)} ref={ref || undefined} /> </StyledTextarea> )); export default Textarea;
Now, instead of passing a string (formState.commentBody) as value into Textarea, I want to pass some jsx code:
<blockquote> this is a customizable text and clickable within textarea </blockquote>
into <textarea> as its children, such that it would be equivalent to :
<textarea>
<TextareaAutoSize> <blockquote> this is a customizable text and clickable within textarea </blockquote> </TextareaAutoSize>
The final goal is to be able to display block code inside the textarea. Does this library support it? How can I achieve this?
I tried to code inside the TextareaAutoSize component directly like this:
TextareaAutoSize
const Textarea = forwardRef(({ className, invalid, onChange, ...textareaProps }, ref) => ( <StyledTextarea className={className} invalid={invalid}> <TextareaAutoSize {...textareaProps} onChange={event => onChange(event.target.value, event)} ref={ref || undefined} > <blockquote> hahaha </blockquote> </TextareaAutoSize> </StyledTextarea> )); export default Textarea;
However it is displaying:
[object Object]
Why is this happening?
The text was updated successfully, but these errors were encountered:
This component renders <textarea/> and that doesn't accept any children. You are looking for a library support contenteditable elements
<textarea/>
contenteditable
Sorry, something went wrong.
No branches or pull requests
I am using it like this:
what gets displayed in the textarea is just
formState.commentBody
andTextarea
is defined as:Now, instead of passing a string (
formState.commentBody
) as value intoTextarea
, I want to pass some jsx code:into
<textarea>
as its children, such that it would be equivalent to :The final goal is to be able to display block code inside the textarea.
Does this library support it?
How can I achieve this?
I tried to code inside the
TextareaAutoSize
component directly like this:However it is displaying:
[object Object]
![Screen Shot 2022-10-18 at 4 26 20 PM](https://user-images.githubusercontent.com/2807843/196366544-da556525-9203-4f99-855f-4dc770e1dbfd.png)
Why is this happening?
The text was updated successfully, but these errors were encountered: