({children}: ThreadScrollButtonProps)
| 321 | // TODO: wrapper so we can do the "if isNearBottom then hide" logic, could do this via inline styles perhaps |
| 322 | // and ditch the wrapper? |
| 323 | export function ThreadScrollButton({children}: ThreadScrollButtonProps) { |
| 324 | let {isNearBottom, scrollToBottom, ...buttonProps} = useContext(ThreadScrollButtonContext); |
| 325 | let ref = useRef<HTMLDivElement>(null); |
| 326 | let isVisible = !isNearBottom; |
| 327 | let isExiting = useExitAnimation(ref, isVisible); |
| 328 | |
| 329 | if (!isVisible && !isExiting) { |
| 330 | return null; |
| 331 | } |
| 332 | |
| 333 | return ( |
| 334 | <ButtonContext.Provider |
| 335 | value={{slots: {[DEFAULT_SLOT]: {}, scroll: {onPress: scrollToBottom, ...buttonProps}}}}> |
| 336 | <ThreadScrollButtonInner domRef={ref} isExiting={isExiting}> |
| 337 | {children} |
| 338 | </ThreadScrollButtonInner> |
| 339 | </ButtonContext.Provider> |
| 340 | ); |
| 341 | } |
| 342 | |
| 343 | interface ThreadScrollButtonInnerProps { |
| 344 | domRef: RefObject<HTMLDivElement | null>; |
nothing calls this directly
no test coverage detected