longform: change focus mode to only hide chrome on scroll down, tap to restore
Previously scrolling up would restore the nav/tab bars. Now only tapping restores chrome, giving a cleaner reading experience without accidental restoration while scrolling. Changelog-Changed: Changed focus mode to only hide navigation on scroll down Signed-off-by: alltheseas
This commit is contained in:
committed by
Daniel D’Aquino
parent
c934bc7653
commit
760d0a8126
@@ -69,22 +69,18 @@ struct ChatroomThreadView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Updates chrome visibility based on scroll direction (longform only).
|
/// Updates chrome visibility based on scroll direction (longform only).
|
||||||
/// Scrolling down hides chrome, scrolling up shows it.
|
/// Scrolling down hides chrome; tap to restore (scroll up does not restore).
|
||||||
private func updateChromeVisibility(newY: CGFloat) {
|
private func updateChromeVisibility(newY: CGFloat) {
|
||||||
guard isLongformEvent else { return }
|
guard isLongformEvent else { return }
|
||||||
|
|
||||||
let delta = newY - lastScrollY
|
let delta = newY - lastScrollY
|
||||||
|
|
||||||
// Only toggle chrome state if scroll exceeds threshold
|
// Only hide chrome on scroll down, don't restore on scroll up (use tap instead)
|
||||||
if abs(delta) > scrollThreshold {
|
if delta < -scrollThreshold && !chromeHidden {
|
||||||
let shouldHide = delta < 0 // Scrolling down (content moving up)
|
withAnimation(.easeInOut(duration: 0.25)) {
|
||||||
|
chromeHidden = true
|
||||||
if shouldHide != chromeHidden {
|
|
||||||
withAnimation(.easeInOut(duration: 0.25)) {
|
|
||||||
chromeHidden = shouldHide
|
|
||||||
}
|
|
||||||
notify(.display_tabbar(!shouldHide))
|
|
||||||
}
|
}
|
||||||
|
notify(.display_tabbar(false))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always update lastScrollY to prevent stale delta accumulation
|
// Always update lastScrollY to prevent stale delta accumulation
|
||||||
|
|||||||
Reference in New Issue
Block a user