Skip to content

Commit

Permalink
🐛 fix: slove scroll to bottom button was not work
Browse files Browse the repository at this point in the history
  • Loading branch information
ONLY-yours committed Apr 23, 2024
1 parent 2b247dd commit f426bc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/BackBottom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const BackBottom = (props: BackBottomProps) => {
}, []);

const current = useMemo(() => {
if (target.current && target.current.scrollHeight > target.current.clientHeight) {
if (target.current) {
return target.current;
}
return document.body;
Expand Down Expand Up @@ -98,7 +98,7 @@ const BackBottom = (props: BackBottomProps) => {
}, [current]);

useEffect(() => {
if (scroll?.top && !alwaysShow) {
if (!alwaysShow) {
setVisible(scroll?.top + clientHeight + visibilityHeight < scrollHeight);
}
}, [scrollHeight, scroll, visibilityHeight, current]);
Expand Down
2 changes: 1 addition & 1 deletion src/ProChat/container/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const App = memo<ConversationProps>(
/>
{ref?.current && <ChatScrollAnchor target={ref} />}
</div>
{isRender ? (
{isRender && ref?.current ? (
<BackBottom
style={{
bottom: 138,
Expand Down

0 comments on commit f426bc0

Please sign in to comment.