amis-rpc-design/node_modules/rc-virtual-list/es/hooks/useChildren.js

20 lines
617 B
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
import * as React from 'react';
import { Item } from '../Item';
export default function useChildren(list, startIndex, endIndex, scrollWidth, setNodeRef, renderFunc, _ref) {
var getKey = _ref.getKey;
return list.slice(startIndex, endIndex + 1).map(function (item, index) {
var eleIndex = startIndex + index;
var node = renderFunc(item, eleIndex, {
style: {
width: scrollWidth
}
});
var key = getKey(item);
return /*#__PURE__*/React.createElement(Item, {
key: key,
setRef: function setRef(ele) {
return setNodeRef(item, ele);
}
}, node);
});
}