Fix scroll direction stopped working

s/up/start s/down/end
This commit is contained in:
Lim Chee Aun 2023-01-14 20:16:13 +08:00
parent e2139399ee
commit 0dcccd1e57

View file

@ -258,7 +258,7 @@ function Home({ hidden }) {
tabIndex="-1" tabIndex="-1"
> >
<button <button
hidden={scrollDirection === 'down' && !nearReachStart} hidden={scrollDirection === 'end' && !nearReachStart}
type="button" type="button"
id="compose-button" id="compose-button"
onClick={(e) => { onClick={(e) => {
@ -277,7 +277,7 @@ function Home({ hidden }) {
</button> </button>
<div class="timeline-deck deck"> <div class="timeline-deck deck">
<header <header
hidden={scrollDirection === 'down' && !nearReachStart} hidden={scrollDirection === 'end' && !nearReachStart}
onClick={() => { onClick={() => {
scrollableRef.current?.scrollTo({ top: 0, behavior: 'smooth' }); scrollableRef.current?.scrollTo({ top: 0, behavior: 'smooth' });
}} }}
@ -315,7 +315,7 @@ function Home({ hidden }) {
</div> </div>
</header> </header>
{snapStates.homeNew.length > 0 && {snapStates.homeNew.length > 0 &&
scrollDirection === 'up' && scrollDirection === 'start' &&
!nearReachStart && !nearReachStart &&
!nearReachEnd && ( !nearReachEnd && (
<button <button