Add reset scroll direction

When showing back the header on-demand, it got confused by current scroll direction
pull/1261/head
Lim Chee Aun 2025-09-05 10:16:23 +08:00
rodzic f7a3fc747a
commit 870ae4f28f
3 zmienionych plików z 20 dodań i 13 usunięć

Wyświetl plik

@ -285,7 +285,7 @@ function Timeline({
const headerRef = useRef();
// const [hiddenUI, setHiddenUI] = useState(false);
const [nearReachStart, setNearReachStart] = useState(false);
useScrollFn(
const { resetScrollDirection } = useScrollFn(
{
scrollableRef,
distanceFromEnd: 2,
@ -437,6 +437,7 @@ function Timeline({
) {
setTimeout(() => {
headerRef.current.hidden = false;
resetScrollDirection();
}, 250);
}
}}

24
src/locales/en.po wygenerowano
Wyświetl plik

@ -330,7 +330,7 @@ msgstr "More from <0/>"
#: src/components/columns.jsx:27
#: src/components/nav-menu.jsx:181
#: src/components/shortcuts-settings.jsx:139
#: src/components/timeline.jsx:470
#: src/components/timeline.jsx:471
#: src/pages/catchup.jsx:883
#: src/pages/filters.jsx:90
#: src/pages/followed-hashtags.jsx:41
@ -492,7 +492,7 @@ msgstr "Attachment #{i} failed"
#: src/components/compose.jsx:1262
#: src/components/status.jsx:2096
#: src/components/timeline.jsx:1015
#: src/components/timeline.jsx:1016
msgid "Content warning"
msgstr ""
@ -743,7 +743,7 @@ msgid "Accounts"
msgstr ""
#: src/components/generic-accounts.jsx:214
#: src/components/timeline.jsx:552
#: src/components/timeline.jsx:553
#: src/pages/list.jsx:321
#: src/pages/notifications.jsx:923
#: src/pages/search.jsx:562
@ -752,7 +752,7 @@ msgid "Show more…"
msgstr ""
#: src/components/generic-accounts.jsx:219
#: src/components/timeline.jsx:557
#: src/components/timeline.jsx:558
#: src/pages/search.jsx:567
msgid "The end."
msgstr ""
@ -780,13 +780,13 @@ msgstr ""
#: src/components/gif-picker-modal.jsx:207
#: src/components/media-modal.jsx:469
#: src/components/timeline.jsx:928
#: src/components/timeline.jsx:929
msgid "Previous"
msgstr ""
#: src/components/gif-picker-modal.jsx:225
#: src/components/media-modal.jsx:488
#: src/components/timeline.jsx:945
#: src/components/timeline.jsx:946
msgid "Next"
msgstr ""
@ -1151,7 +1151,7 @@ msgstr ""
#: src/components/status-compact.jsx:70
#: src/components/status.jsx:2873
#: src/components/status.jsx:2951
#: src/components/timeline.jsx:1004
#: src/components/timeline.jsx:1005
#: src/pages/catchup.jsx:75
#: src/pages/catchup.jsx:1880
msgid "Filtered"
@ -2604,12 +2604,12 @@ msgstr "{index}/{total}"
msgid "{index}/X"
msgstr "{index}/X"
#: src/components/timeline.jsx:486
#: src/components/timeline.jsx:487
#: src/pages/settings.jsx:1218
msgid "New posts"
msgstr ""
#: src/components/timeline.jsx:587
#: src/components/timeline.jsx:588
#: src/pages/home.jsx:228
#: src/pages/notifications.jsx:899
#: src/pages/status.jsx:1099
@ -2618,16 +2618,16 @@ msgid "Try again"
msgstr ""
#. placeholder {0}: fItems.length
#: src/components/timeline.jsx:622
#: src/components/timeline.jsx:623
msgid "{0, plural, one {# Boost} other {# Boosts}}"
msgstr "{0, plural, one {# Boost} other {# Boosts}}"
#: src/components/timeline.jsx:627
#: src/components/timeline.jsx:628
msgid "Pinned posts"
msgstr "Pinned posts"
#. placeholder {0}: filterInfo.titlesStr
#: src/components/timeline.jsx:999
#: src/components/timeline.jsx:1000
msgid "<0>Filtered</0>: <1>{0}</1>"
msgstr ""

Wyświetl plik

@ -138,6 +138,12 @@ export default function useScrollFn(
}
}, [init]);
return {
resetScrollDirection: () => {
scrollDirection.current = null;
},
};
// return {
// scrollDirection,
// reachStart,