1.0.5-1.5.0 #6

Merged
Royce59 merged 7 commits from dev into main 2026-02-20 16:26:09 +00:00
Showing only changes of commit 142082ba83 - Show all commits

View File

@@ -21,6 +21,7 @@ export function Messages() {
const isFirstRenderRef = useRef(true);
const previousScrollHeightRef = useRef(0);
const distanceFromButtomRef = useRef(0);
const distanceFromTopRef = useRef(0);
const [affix, setAffix] = useState(false);
const [wallpaper] = useSetting<string>
@@ -120,7 +121,8 @@ export function Messages() {
const lastMessage = messages[messages.length - 1];
// Скроллим если пользователь внизу или это его собственное сообщение
if ((shouldAutoScrollRef.current || lastMessage.from_me)) {
if ((shouldAutoScrollRef.current || lastMessage.from_me) && distanceFromTopRef.current > 10) {
console.info(distanceFromTopRef.current);
scrollToBottom(true);
}
}, [messages.length, loading, scrollToBottom]);
@@ -175,6 +177,8 @@ export function Messages() {
onScrollPositionChange={(scroll) => {
if (!viewportRef.current) return;
distanceFromTopRef.current = scroll.y;
// Загружаем старые сообщения при достижении верха
if (scroll.y === 0 && !loading && messages.length >= 20) {
loadMessagesToScrollAreaTop();