@apteva/apteva-kit 0.1.50 → 0.1.52
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.
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -3
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1607,12 +1607,24 @@ function MessageList({
|
|
|
1607
1607
|
onWidgetRender
|
|
1608
1608
|
}) {
|
|
1609
1609
|
const listRef = _react.useRef.call(void 0, null);
|
|
1610
|
-
_react.
|
|
1610
|
+
const isNearBottomRef = _react.useRef.call(void 0, true);
|
|
1611
|
+
const lastScrollHeightRef = _react.useRef.call(void 0, 0);
|
|
1612
|
+
const handleScroll = () => {
|
|
1611
1613
|
if (listRef.current) {
|
|
1612
|
-
|
|
1614
|
+
const { scrollTop, scrollHeight, clientHeight } = listRef.current;
|
|
1615
|
+
isNearBottomRef.current = scrollHeight - scrollTop - clientHeight < 100;
|
|
1616
|
+
}
|
|
1617
|
+
};
|
|
1618
|
+
_react.useEffect.call(void 0, () => {
|
|
1619
|
+
if (listRef.current && isNearBottomRef.current) {
|
|
1620
|
+
const currentScrollHeight = listRef.current.scrollHeight;
|
|
1621
|
+
if (currentScrollHeight !== lastScrollHeightRef.current) {
|
|
1622
|
+
listRef.current.scrollTop = currentScrollHeight;
|
|
1623
|
+
lastScrollHeightRef.current = currentScrollHeight;
|
|
1624
|
+
}
|
|
1613
1625
|
}
|
|
1614
1626
|
}, [messages]);
|
|
1615
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: listRef, className: "apteva-message-list apteva-scrollbar-hidden", children: messages.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1627
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: listRef, className: "apteva-message-list apteva-scrollbar-hidden", onScroll: handleScroll, children: messages.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1616
1628
|
WelcomeScreen,
|
|
1617
1629
|
{
|
|
1618
1630
|
title: welcomeTitle,
|