diff --git a/app/soapbox/components/ui/streamfield/streamfield.tsx b/app/soapbox/components/ui/streamfield/streamfield.tsx index bb2ca0ba5..9ca795ada 100644 --- a/app/soapbox/components/ui/streamfield/streamfield.tsx +++ b/app/soapbox/components/ui/streamfield/streamfield.tsx @@ -16,6 +16,7 @@ const messages = defineMessages({ export type StreamfieldComponent = React.ComponentType<{ value: T onChange: (value: T) => void + autoFocus: boolean }>; interface IStreamfield { @@ -72,7 +73,12 @@ const Streamfield: React.FC = ({ {values.map((value, i) => value?._destroy ? null : ( - + 0} + /> {values.length > minItems && onRemoveItem && ( = ({ tags, onChange, onAddItem, ); }; -interface IHashtagField { - value: string - onChange: (value: string) => void -} - -const HashtagField: React.FC = ({ value, onChange }) => { +const HashtagField: StreamfieldComponent = ({ value, onChange, autoFocus = false }) => { const intl = useIntl(); const handleChange: React.ChangeEventHandler = ({ target }) => { @@ -49,6 +46,7 @@ const HashtagField: React.FC = ({ value, onChange }) => { value={value} onChange={handleChange} placeholder={intl.formatMessage(messages.hashtagPlaceholder)} + autoFocus={autoFocus} /> ); };