11import React , { ReactNode } from 'react' ;
22import { Activity , NewActivity , UR } from 'getstream' ;
33import {
4- ImageUploadButton ,
5- FileUploadButton ,
6- ImagePreviewer ,
74 FilePreviewer ,
8- ImageDropzone ,
9- LoadingIndicator ,
105 FileUpload ,
6+ FileUploadButton ,
7+ ImageDropzone ,
8+ ImagePreviewer ,
119 ImageUpload ,
10+ ImageUploadButton ,
11+ LoadingIndicator ,
1212} from 'react-file-utils' ;
1313
1414import { DefaultAT , DefaultUT , useTranslationContext } from '../../context' ;
15- import { PropsWithElementAttributes } from '../../utils' ;
15+ import { ElementOrComponentOrLiteralType , PropsWithElementAttributes , smartRender } from '../../utils' ;
1616import { useStatusUpdateForm } from './useStatusUpdateForm' ;
17- import { Panel , PanelContent , PanelHeading , PanelFooter } from '../Panel' ;
18- import { Textarea , TextareaProps } from '../Textarea' ;
17+ import { Panel , PanelContent , PanelFooter , PanelHeading } from '../Panel' ;
18+ import { Textarea as DefaultTextarea , TextareaProps } from '../Textarea' ;
1919import { Avatar } from '../Avatar' ;
2020import { Card } from '../Card' ;
2121import { Audio } from '../Audio' ;
@@ -58,6 +58,8 @@ export type StatusUpdateFormProps<AT extends DefaultAT = DefaultAT> = PropsWithE
5858 modifyActivityData ?: ( activity : NewActivity < AT > ) => NewActivity < AT > ;
5959 /** A callback to run after the activity is posted successfully */
6060 onSuccess ?: ( activity : Activity < AT > ) => void ;
61+ /** Custom Textarea component implementation */
62+ Textarea ?: ElementOrComponentOrLiteralType < Omit < TextareaProps , 'maxLength' | 'rows' > > ;
6163 /** An extra trigger for ReactTextareaAutocomplete, this can be used to show
6264 * a menu when typing @xxx or #xxx, in addition to the emoji menu when typing
6365 * :xxx */
@@ -81,6 +83,7 @@ export function StatusUpdateForm<
8183 emojiI18n,
8284 Header,
8385 FooterItem,
86+ Textarea = DefaultTextarea ,
8487 trigger,
8588 doRequest,
8689 userId,
@@ -112,15 +115,15 @@ export function StatusUpdateForm<
112115 </ div >
113116 ) }
114117
115- < Textarea
116- innerRef = { state . textInputRef }
117- placeholder = { t ( 'Type your post...' ) }
118- value = { state . text }
119- onChange = { state . onChange }
120- emojiData = { emojiData }
121- trigger = { trigger }
122- onPaste = { state . onPaste }
123- />
118+ { smartRender ( Textarea , {
119+ emojiData ,
120+ innerRef : state . textInputRef ,
121+ onChange : state . onChange ,
122+ onPaste : state . onPaste ,
123+ placeholder : t ( 'Type your post...' ) ,
124+ trigger,
125+ value : state . text ,
126+ } ) }
124127 </ div >
125128
126129 { state . isOgScraping && (
0 commit comments