Changeset View
Changeset View
Standalone View
Standalone View
web/chat/typeahead-tooltip.react.js
Show All 32 Lines | function TypeaheadTooltip(props: TypeaheadTooltipProps): React.Node { | ||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setIsVisibleForAnimation(true); | setIsVisibleForAnimation(true); | ||||
return () => setIsVisibleForAnimation(false); | return () => setIsVisibleForAnimation(false); | ||||
}, []); | }, []); | ||||
const actions = React.useMemo( | const actions = React.useMemo( | ||||
() => | () => | ||||
getTypeaheadTooltipActions( | getTypeaheadTooltipActions({ | ||||
inputState, | inputStateDraft: inputState.draft, | ||||
textarea, | inputStateSetDraft: inputState.setDraft, | ||||
inputStateSetTextCursorPosition: inputState.setTextCursorPosition, | |||||
suggestedUsers, | suggestedUsers, | ||||
textBeforeAtSymbol, | textBeforeAtSymbol, | ||||
usernamePrefix, | usernamePrefix, | ||||
), | }), | ||||
[inputState, textarea, suggestedUsers, textBeforeAtSymbol, usernamePrefix], | [ | ||||
inputState.draft, | |||||
inputState.setDraft, | |||||
inputState.setTextCursorPosition, | |||||
suggestedUsers, | |||||
textBeforeAtSymbol, | |||||
usernamePrefix, | |||||
], | |||||
); | ); | ||||
const tooltipPosition = React.useMemo( | const tooltipPosition = React.useMemo( | ||||
() => | () => | ||||
getTypeaheadTooltipPosition(textarea, actions.length, textBeforeAtSymbol), | getTypeaheadTooltipPosition(textarea, actions.length, textBeforeAtSymbol), | ||||
[textarea, actions.length, textBeforeAtSymbol], | [textarea, actions.length, textBeforeAtSymbol], | ||||
); | ); | ||||
Show All 33 Lines |