kasunk99-livestream-core 0.3.34 → 0.3.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveStreamViewerItem.d.ts","sourceRoot":"","sources":["../../src/components/LiveStreamViewerItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAiB1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM/C,KAAK,yBAAyB,GAAG;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD,CAAC;AAmEF,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"LiveStreamViewerItem.d.ts","sourceRoot":"","sources":["../../src/components/LiveStreamViewerItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAiB1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM/C,KAAK,yBAAyB,GAAG;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD,CAAC;AAmEF,eAAO,MAAM,oBAAoB,uDAwa/B,CAAC"}
|
|
@@ -129,7 +129,7 @@ export const LiveStreamViewerItem = memo(function LiveStreamViewerItem({ stream,
|
|
|
129
129
|
return { id, displayName, text, timestamp };
|
|
130
130
|
})
|
|
131
131
|
.filter(Boolean);
|
|
132
|
-
return normalized;
|
|
132
|
+
return normalized.sort((a, b) => a.timestamp - b.timestamp);
|
|
133
133
|
});
|
|
134
134
|
}, [roomId, seededFromRoomState]);
|
|
135
135
|
useEffect(() => {
|
|
@@ -165,6 +165,22 @@ export const LiveStreamViewerItem = memo(function LiveStreamViewerItem({ stream,
|
|
|
165
165
|
};
|
|
166
166
|
}, [isActive, roomId, socket]);
|
|
167
167
|
const chatData = useMemo(() => chatMessages, [chatMessages]);
|
|
168
|
+
// Snap to bottom instantly when joining/rejoining a room.
|
|
169
|
+
// Uses a short delay so seeded messages have time to render before scrolling.
|
|
170
|
+
// Also covers the case where rejoin produces the same message count as before
|
|
171
|
+
// (length-only dependency would not re-fire in that case).
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
if (!roomId)
|
|
174
|
+
return;
|
|
175
|
+
const t = setTimeout(() => {
|
|
176
|
+
try {
|
|
177
|
+
chatListRef.current?.scrollToEnd({ animated: false });
|
|
178
|
+
}
|
|
179
|
+
catch { /* ignore */ }
|
|
180
|
+
}, 100);
|
|
181
|
+
return () => clearTimeout(t);
|
|
182
|
+
}, [roomId]);
|
|
183
|
+
// Animate to bottom when a new real-time message arrives.
|
|
168
184
|
useEffect(() => {
|
|
169
185
|
if (!chatListRef.current || chatData.length === 0)
|
|
170
186
|
return;
|
package/package.json
CHANGED