({children}: ThreadScrollButtonProps)
| 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? |
| 291 | export 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 | |
| 311 | interface ThreadScrollButtonInnerProps { |
| 312 | domRef: RefObject<HTMLDivElement | null>; |
nothing calls this directly
no test coverage detected