Skip to content

Commit 40ddb8c

Browse files
committed
fix: stutter when scrolling to message
1 parent 17c8693 commit 40ddb8c

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

package/src/components/MessageList/MessageFlashList.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,6 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
463463
clearTimeout(scrollToDebounceTimeoutRef.current);
464464
await loadChannelAroundMessage({ messageId, setTargetedMessage });
465465
} else {
466-
flashListRef.current?.scrollToIndex({
467-
animated: true,
468-
index: indexOfParentInMessageList,
469-
viewPosition: 0.5,
470-
});
471466
setTargetedMessage(messageId);
472467
}
473468
} catch (e) {
@@ -1094,11 +1089,6 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
10941089
[contentContainer],
10951090
);
10961091

1097-
const getItemType = useStableCallback((item: LocalMessage) => {
1098-
const type = getItemTypeInternal(item);
1099-
return client.userID === item.user?.id ? `own-${type}` : type;
1100-
});
1101-
11021092
const currentListHeightRef = useRef<number | undefined>(undefined);
11031093

11041094
const onLayout = useStableCallback((e: LayoutChangeEvent) => {
@@ -1144,7 +1134,7 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
11441134
contentContainerStyle={flatListContentContainerStyle}
11451135
data={processedMessageList}
11461136
drawDistance={800}
1147-
getItemType={getItemType}
1137+
getItemType={getItemTypeInternal}
11481138
initialScrollIndex={
11491139
indexToScrollToRef.current === -1 ? undefined : indexToScrollToRef.current
11501140
}

0 commit comments

Comments
 (0)