MCPcopy Index your code
hub / github.com/adobe/react-spectrum / ThreadScrollButton

Function ThreadScrollButton

packages/@react-spectrum/ai/src/Chat.tsx:291–309  ·  view source on GitHub ↗
({children}: ThreadScrollButtonProps)

Source from the content-addressed store, hash-verified

289// TODO: wrapper so we can do the "if isNearBottom then hide" logic, could do this via inline styles perhaps
290// and ditch the wrapper?
291export function ThreadScrollButton({children}: ThreadScrollButtonProps) {
292 let {isNearBottom, scrollToBottom} = useContext(ThreadScrollButtonContext);
293 let ref = useRef<HTMLDivElement>(null);
294 let isVisible = !isNearBottom;
295 let isExiting = useExitAnimation(ref, isVisible);
296
297 if (!isVisible && !isExiting) {
298 return null;
299 }
300
301 return (
302 <ButtonContext.Provider
303 value={{slots: {[DEFAULT_SLOT]: {}, scroll: {onPress: scrollToBottom}}}}>
304 <ThreadScrollButtonInner domRef={ref} isExiting={isExiting}>
305 {children}
306 </ThreadScrollButtonInner>
307 </ButtonContext.Provider>
308 );
309}
310
311interface ThreadScrollButtonInnerProps {
312 domRef: RefObject<HTMLDivElement | null>;

Callers

nothing calls this directly

Calls 1

useExitAnimationFunction · 0.90

Tested by

no test coverage detected