[Chat] Defer message send until after textinput resizes (#10405)
This commit is contained in:
@@ -90,7 +90,6 @@ export function MessageComposer({
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearDraft()
|
clearDraft()
|
||||||
onSendMessage(message)
|
|
||||||
playHaptic()
|
playHaptic()
|
||||||
setEmbed(undefined)
|
setEmbed(undefined)
|
||||||
composerInternalApiRef.current?.clear()
|
composerInternalApiRef.current?.clear()
|
||||||
@@ -98,6 +97,11 @@ export function MessageComposer({
|
|||||||
if (IS_WEB) {
|
if (IS_WEB) {
|
||||||
composerInternalApiRef.current?.input?.focus()
|
composerInternalApiRef.current?.input?.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// defer send by a frame so that the textinput resizes before we send the message
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
onSendMessage(message)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const isFlushingAutocorrectSuggestion = useRef(false)
|
const isFlushingAutocorrectSuggestion = useRef(false)
|
||||||
@@ -290,7 +294,7 @@ export function ComposerContainer({children}: {children: React.ReactNode}) {
|
|||||||
paddingHorizontal: interpolate(
|
paddingHorizontal: interpolate(
|
||||||
progress.get(),
|
progress.get(),
|
||||||
[0, 1],
|
[0, 1],
|
||||||
[bottomInset, tokens.space.sm],
|
[bottomInset, tokens.space.md],
|
||||||
{
|
{
|
||||||
extrapolateRight: Extrapolation.CLAMP,
|
extrapolateRight: Extrapolation.CLAMP,
|
||||||
extrapolateLeft: Extrapolation.CLAMP,
|
extrapolateLeft: Extrapolation.CLAMP,
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ export function MessageInput({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
clearDraft()
|
clearDraft()
|
||||||
void onSendMessage(message)
|
|
||||||
playHaptic()
|
playHaptic()
|
||||||
setEmbed(undefined)
|
setEmbed(undefined)
|
||||||
setMessage('')
|
setMessage('')
|
||||||
@@ -99,6 +98,10 @@ export function MessageInput({
|
|||||||
inputRef.current?.focus()
|
inputRef.current?.focus()
|
||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
void onSendMessage(message)
|
||||||
|
})
|
||||||
}, [
|
}, [
|
||||||
needsEmailVerification,
|
needsEmailVerification,
|
||||||
hasEmbed,
|
hasEmbed,
|
||||||
|
|||||||
Reference in New Issue
Block a user