yt-chat-components 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-chat-components",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "main": "build/static/js/bundle.min.js",
5
5
  "module": "build/static/js/bundle.min.js",
6
6
  "types": "build/static/js/index.d.ts",
@@ -245,8 +245,9 @@ const ChatWindow = forwardRef<ChatWindowRef, ChatWindowProps>(({
245
245
 
246
246
  const handleScroll = () => {
247
247
  const { scrollTop, scrollHeight, clientHeight } = container;
248
- const isAtBottom = scrollHeight - scrollTop <= clientHeight + 10; // <= 更稳妥
249
-
248
+ const isAtBottom = scrollHeight - scrollTop - clientHeight <= 10; // <= 更稳妥
249
+ console.log("与底部距离===", scrollHeight - scrollTop - clientHeight)
250
+ console.log("此前是否向上滚动", isUserScrolledUp)
250
251
  if (!isAtBottom && !isUserScrolledUp) {
251
252
  setIsUserScrolledUp(true);
252
253
  } else if (isAtBottom && isUserScrolledUp) {
@@ -270,7 +271,7 @@ const ChatWindow = forwardRef<ChatWindowRef, ChatWindowProps>(({
270
271
  const isCurrentlyAtBottom = scrollHeight - scrollTop - clientHeight < 120; //
271
272
  if (isForce) {
272
273
  container.scrollTop = scrollHeight;
273
- setIsUserScrolledUp(false); // 强制滚动后认为用户在底部
274
+ // setIsUserScrolledUp(false); // 强制滚动后认为用户在底部
274
275
  return;
275
276
  }
276
277
  if (isCurrentlyAtBottom) {