SpoilerInput: fix ref

This commit is contained in:
Alex Gleason 2022-10-31 16:23:17 -05:00
parent f51f2984a5
commit 69157097dd
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 5 additions and 3 deletions

View file

@ -316,6 +316,7 @@ const ComposeForm = <ID extends string>({ id, shouldCondense, autoFocus, clickab
onSuggestionsFetchRequested={onSuggestionsFetchRequested}
onSuggestionsClearRequested={onSuggestionsClearRequested}
onSuggestionSelected={onSpoilerSuggestionSelected}
ref={spoilerTextRef}
/>
</Stack>
}

View file

@ -18,12 +18,12 @@ interface ISpoilerInput extends Pick<IAutosuggestInput, 'onSuggestionsFetchReque
}
/** Text input for content warning in composer. */
const SpoilerInput: React.FC<ISpoilerInput> = ({
const SpoilerInput = React.forwardRef<AutosuggestInput, ISpoilerInput>(({
composeId,
onSuggestionsFetchRequested,
onSuggestionsClearRequested,
onSuggestionSelected,
}) => {
}, ref) => {
const intl = useIntl();
const dispatch = useAppDispatch();
const compose = useCompose(composeId);
@ -63,6 +63,7 @@ const SpoilerInput: React.FC<ISpoilerInput> = ({
searchTokens={[':']}
id='cw-spoiler-input'
className='rounded-md dark:!bg-transparent !bg-transparent'
ref={ref}
autoFocus
/>
@ -74,6 +75,6 @@ const SpoilerInput: React.FC<ISpoilerInput> = ({
</Stack>
</Stack>
);
};
});
export default SpoilerInput;