chore: comments
This commit is contained in:
@@ -42,7 +42,7 @@ const MessageFeed = ({ context, id }: Props) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// 上下文有变动,则滚动到底部
|
// context changed, scroll to bottom
|
||||||
console.log("listRef", listRef);
|
console.log("listRef", listRef);
|
||||||
if (listRef && listRef.current) {
|
if (listRef && listRef.current) {
|
||||||
const list = listRef.current;
|
const list = listRef.current;
|
||||||
@@ -58,7 +58,7 @@ const MessageFeed = ({ context, id }: Props) => {
|
|||||||
|
|
||||||
}, [context, id]);
|
}, [context, id]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// 需要检测滚动位置,如果距离底部超过阈值,则不滚到底部
|
// check current scroll position first, scroll to bottom only when under the trigger number
|
||||||
if (ref && ref.current) {
|
if (ref && ref.current) {
|
||||||
const container = ref.current;
|
const container = ref.current;
|
||||||
const { scrollHeight, scrollTop, offsetHeight } = container;
|
const { scrollHeight, scrollTop, offsetHeight } = container;
|
||||||
@@ -94,7 +94,7 @@ const MessageFeed = ({ context, id }: Props) => {
|
|||||||
onViewportIndexesChange={handleMessageListChange}
|
onViewportIndexesChange={handleMessageListChange}
|
||||||
overscan={10}
|
overscan={10}
|
||||||
// itemSize={100}
|
// itemSize={100}
|
||||||
initialPrerender={30}
|
initialPrerender={40}
|
||||||
scrollThreshold={2000}
|
scrollThreshold={2000}
|
||||||
ref={listRef}
|
ref={listRef}
|
||||||
viewportRef={ref}
|
viewportRef={ref}
|
||||||
|
|||||||
Reference in New Issue
Block a user