fix(now-indicator): use UI-thread visibleDateUnixAnim to eliminate debounce delay#33
Draft
ribamarsantos wants to merge 1 commit into
Conversation
…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.
This was referenced Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
useSyncedList— 150 ms debounceVisibleDateProvider— 50 ms debounceuseDateChangedListenerreads from this debounced JS-thread value, so the now-indicator's visibility update always lagged behind the scroll.Solution
Replace
useDateChangedListenerwithvisibleDateUnixAnimfromuseCalendar. This shared value is updated immediately on the UI thread whenever a column boundary is crossed — the same source already used byuseVisibleDayUnixfor week-header day chips.dayIndexandinRangeare converted touseDerivedValueworklets so opacity is driven directly on the UI thread per scroll frame, with no React re-render needed for show/hide.The
inRangeflag is threaded intoNowIndicatorInneras an optionalSharedValue<boolean>prop so the inner component stays reusable (e.g.NowIndicatorResourcecontinues using its own logic unchanged).Changes
NowIndicator.tsx: replaceuseMemo+useDateChangedListenerwithuseDerivedValueworklets readingvisibleDateUnixAnim; add optionalinRange: SharedValue<boolean>prop toNowIndicatorInner; remove JS-thread early-return guard (replaced by UI-thread opacity)