(fix): messages at the top overlapping
This commit is contained in:
parent
78f354d0d3
commit
0c933e4890
1 changed files with 2 additions and 8 deletions
|
|
@ -102,12 +102,6 @@ export default function Screen() {
|
||||||
const virtualRowCount =
|
const virtualRowCount =
|
||||||
messages.length + (shouldShowConversationStart ? 1 : 0);
|
messages.length + (shouldShowConversationStart ? 1 : 0);
|
||||||
|
|
||||||
const messagesRef = React.useRef(messages);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
messagesRef.current = messages;
|
|
||||||
}, [messages]);
|
|
||||||
|
|
||||||
const getItemKey = React.useCallback(
|
const getItemKey = React.useCallback(
|
||||||
(index: number) => {
|
(index: number) => {
|
||||||
if (shouldShowConversationStart && index === 0) {
|
if (shouldShowConversationStart && index === 0) {
|
||||||
|
|
@ -115,9 +109,9 @@ export default function Screen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const messageIndex = shouldShowConversationStart ? index - 1 : index;
|
const messageIndex = shouldShowConversationStart ? index - 1 : index;
|
||||||
return messagesRef.current[messageIndex]?.send_time ?? index;
|
return messages[messageIndex]?.send_time ?? index;
|
||||||
},
|
},
|
||||||
[shouldShowConversationStart],
|
[shouldShowConversationStart, messages],
|
||||||
);
|
);
|
||||||
|
|
||||||
const setMeasurementRef = React.useCallback(
|
const setMeasurementRef = React.useCallback(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue