()
| 383 | * Hook to use with ScrollArea for external control |
| 384 | */ |
| 385 | export function useScrollToBottom() { |
| 386 | const triggerRef = useRef(0) |
| 387 | const [, forceUpdate] = useReducer((x) => x + 1, 0) |
| 388 | |
| 389 | const scrollToBottom = useCallback(() => { |
| 390 | triggerRef.current += 1 |
| 391 | forceUpdate() |
| 392 | }, []) |
| 393 | |
| 394 | return { |
| 395 | scrollToBottomTrigger: triggerRef.current, |
| 396 | scrollToBottom, |
| 397 | } |
| 398 | } |