Skip to content

Commit ba485ba

Browse files
fix: avoid duplicate day badge from animated header (#2709) (#2747)
After aligning the animated header's date with the visible group, the floating header could briefly show the same date as the inline day separator while that separator was still on screen, producing a stacked duplicate date badge during scroll. Gate the floating header's opacity on relativeScrolledPositionToBottomOfDay: only show it once the current day's inline separator has scrolled off the top (< 0). While the inline separator is still visible (>= 0) it already shows the date, so the floating copy stays hidden - a clean handoff with no duplicate.
1 parent c2fb1c9 commit ba485ba

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

  • src/MessagesContainer/components/DayAnimated

src/MessagesContainer/components/DayAnimated/index.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,17 @@ export const DayAnimated = ({ scrolledY, daysPositions, listHeight, renderDay, m
7171
}), [relativeScrolledPositionToBottomOfDay, containerHeight, dayTopOffset, isLoadingAnim])
7272

7373
const contentStyle = useAnimatedStyle(() => ({
74-
opacity: opacity.value,
75-
}), [opacity])
74+
// Only show the floating header once the current day's inline separator has
75+
// scrolled off the top (relativeScrolledPositionToBottomOfDay < 0). While the
76+
// inline separator is still on screen (>= 0) it already shows the date, so
77+
// hiding the floating copy avoids a duplicate date badge (#2709).
78+
opacity: opacity.value * interpolate(
79+
relativeScrolledPositionToBottomOfDay.value,
80+
[-0.0001, 0],
81+
[1, 0],
82+
'clamp'
83+
),
84+
}), [opacity, relativeScrolledPositionToBottomOfDay])
7685

7786
const fadeOut = useCallback(() => {
7887
'worklet'

0 commit comments

Comments
 (0)