Skip to content

fix(now-indicator): use UI-thread visibleDateUnixAnim to eliminate debounce delay#33

Draft
ribamarsantos wants to merge 1 commit into
anton-patrushev:fix/header-resource-prop-syncfrom
ribamarsantos:fix/now-line-debounce-delay
Draft

fix(now-indicator): use UI-thread visibleDateUnixAnim to eliminate debounce delay#33
ribamarsantos wants to merge 1 commit into
anton-patrushev:fix/header-resource-prop-syncfrom
ribamarsantos:fix/now-line-debounce-delay

Conversation

@ribamarsantos

Copy link
Copy Markdown

Problem

When swiping between weeks, the now-line show/hide was delayed by ~200 ms due to a double-debounce in the JS thread path:

  1. useSyncedList — 150 ms debounce
  2. VisibleDateProvider — 50 ms debounce

useDateChangedListener reads from this debounced JS-thread value, so the now-indicator's visibility update always lagged behind the scroll.

Solution

Replace useDateChangedListener with visibleDateUnixAnim from useCalendar. This shared value is updated immediately on the UI thread whenever a column boundary is crossed — the same source already used by useVisibleDayUnix for week-header day chips.

dayIndex and inRange are converted to useDerivedValue worklets so opacity is driven directly on the UI thread per scroll frame, with no React re-render needed for show/hide.

The inRange flag is threaded into NowIndicatorInner as an optional SharedValue<boolean> prop so the inner component stays reusable (e.g. NowIndicatorResource continues using its own logic unchanged).

Changes

  • NowIndicator.tsx: replace useMemo + useDateChangedListener with useDerivedValue worklets reading visibleDateUnixAnim; add optional inRange: SharedValue<boolean> prop to NowIndicatorInner; remove JS-thread early-return guard (replaced by UI-thread opacity)

…bounce delay

Replaces useDateChangedListener (JS thread, ~200 ms double-debounce via
useSyncedList + VisibleDateProvider) with visibleDateUnixAnim from
useCalendar. dayIndex and inRange are now derived values on the UI thread,
so opacity updates per scroll frame without a React re-render.

This mirrors the approach used by useVisibleDayUnix for week-header chips.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant