UNPKG

@plteam/chat-ui

Version:

CUI Kit is a free and open-source library for creating AI assistant chat interfaces, built with React, Material UI, and TypeScript

17 lines (16 loc) 854 B
import * as React from 'react'; import { useChatScroller } from '../utils/useChatScroller'; import ScrollBottomButton from './ScrollBottomButton'; const ChatScroller = ({ thread, contentRef, scrollApiRef, apiManager }) => { const { scrollButtonEnabled, handleBottomScroll, handleCheckButtonState } = useChatScroller(thread, contentRef); React.useMemo(() => { if (scrollApiRef.current) { scrollApiRef.current.handleBottomScroll = handleBottomScroll; } }, [handleBottomScroll, scrollApiRef.current]); React.useEffect(() => { apiManager.setPrivateMethod('updateScrollButtonState', handleCheckButtonState); }, [handleCheckButtonState]); return (React.createElement(ScrollBottomButton, { enabled: scrollButtonEnabled, onClick: handleBottomScroll })); }; export default ChatScroller;