[🐴] List Adjustments (#3857)

This commit is contained in:
Hailey 2024-05-04 13:22:14 -07:00 committed by GitHub
parent c223bcdaf7
commit eb55bdf172
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 49 additions and 54 deletions

View file

@ -13,6 +13,7 @@ import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {HITSLOP_10} from '#/lib/constants'
import {useHaptics} from 'lib/haptics'
import {atoms as a, useTheme} from '#/alf'
import {PaperPlane_Stroke2_Corner0_Rounded as PaperPlane} from '#/components/icons/PaperPlane'
@ -25,6 +26,7 @@ export function MessageInput({
}) {
const {_} = useLingui()
const t = useTheme()
const playHaptic = useHaptics()
const [message, setMessage] = React.useState('')
const [maxHeight, setMaxHeight] = React.useState<number | undefined>()
const [isInputScrollable, setIsInputScrollable] = React.useState(false)
@ -38,11 +40,12 @@ export function MessageInput({
return
}
onSendMessage(message.trimEnd())
playHaptic()
setMessage('')
setTimeout(() => {
inputRef.current?.focus()
}, 100)
}, [message, onSendMessage])
}, [message, onSendMessage, playHaptic])
const onInputLayout = React.useCallback(
(e: NativeSyntheticEvent<TextInputContentSizeChangeEventData>) => {