Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/MessagesContainer/components/DayAnimated/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,20 @@
}, [messages])

const createdAtDate = useDerivedValue(() => {
// Pick the day the header is currently positioned over. This must use the
// same threshold (day.y + day.height) and last-item fallback as
// `currentDayPosition` which drives the header's vertical position;
// otherwise the displayed date can lag the visible group by one day (#2709).
for (let i = 0; i < daysPositionsArray.value.length; i++) {
const day = daysPositionsArray.value[i]
const dayPosition = day.y + day.height - containerHeight.value - dayBottomMargin
const dayPosition = day.y + day.height

if (absoluteScrolledPositionToBottomOfDay.value < dayPosition)
if (absoluteScrolledPositionToBottomOfDay.value < dayPosition || i === daysPositionsArray.value.length - 1)
return day.createdAt
}

return messagesDates[messagesDates.length - 1]
}, [daysPositionsArray, absoluteScrolledPositionToBottomOfDay, messagesDates, containerHeight, dayBottomMargin])
}, [daysPositionsArray, absoluteScrolledPositionToBottomOfDay, messagesDates])

const style = useAnimatedStyle(() => ({
top: interpolate(
Expand Down Expand Up @@ -88,7 +92,7 @@

useAnimatedReaction(
() => [scrolledY.value, daysPositionsArray],
(value, prevValue) => {

Check warning on line 95 in src/MessagesContainer/components/DayAnimated/index.tsx

View workflow job for this annotation

GitHub Actions / checks (22)

React Hook useAnimatedReaction has missing dependencies: 'daysPositionsArray' and 'scrolledY.value'. Either include them or remove the dependency array

Check warning on line 95 in src/MessagesContainer/components/DayAnimated/index.tsx

View workflow job for this annotation

GitHub Actions / checks (22)

React Hook useAnimatedReaction was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies

Check warning on line 95 in src/MessagesContainer/components/DayAnimated/index.tsx

View workflow job for this annotation

GitHub Actions / checks (24)

React Hook useAnimatedReaction has missing dependencies: 'daysPositionsArray' and 'scrolledY.value'. Either include them or remove the dependency array

Check warning on line 95 in src/MessagesContainer/components/DayAnimated/index.tsx

View workflow job for this annotation

GitHub Actions / checks (24)

React Hook useAnimatedReaction was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies
if (!isScrolledOnMount.value) {
isScrolledOnMount.value = true
return
Expand All @@ -106,7 +110,7 @@

useAnimatedReaction(
() => createdAtDate.value,
(value, prevValue) => {

Check warning on line 113 in src/MessagesContainer/components/DayAnimated/index.tsx

View workflow job for this annotation

GitHub Actions / checks (22)

React Hook useAnimatedReaction has a missing dependency: 'createdAtDate.value'. Either include it or remove the dependency array

Check warning on line 113 in src/MessagesContainer/components/DayAnimated/index.tsx

View workflow job for this annotation

GitHub Actions / checks (22)

React Hook useAnimatedReaction was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies

Check warning on line 113 in src/MessagesContainer/components/DayAnimated/index.tsx

View workflow job for this annotation

GitHub Actions / checks (24)

React Hook useAnimatedReaction has a missing dependency: 'createdAtDate.value'. Either include it or remove the dependency array

Check warning on line 113 in src/MessagesContainer/components/DayAnimated/index.tsx

View workflow job for this annotation

GitHub Actions / checks (24)

React Hook useAnimatedReaction was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies
if (value && value !== prevValue)
runOnJS(setCreatedAt)(value)
},
Expand Down
Loading