Skip to content

Commit 136a759

Browse files
committed
feat: add prop innerClass
1 parent 92f9328 commit 136a759

5 files changed

Lines changed: 2396 additions & 2011 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export default function BaseExample() {
8383
- `renderFoot`: `() => ReactNode`. Customize the persistent rendering content of the list footer. Suitable for absolutely positioned, fixed positioned elements, and elements that do not take up too much space.
8484
- `className`: `string`. Add a CSS class to the list root element.
8585
- `style`: `React.CSSProperties`. Add CSS styles to the list root element.
86+
- `innerClassName`: `string`. Add a CSS class to the list inner element.
8687

8788
## Exposed Methods
8889

lib/VirtualList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export type VirtualListProps<ITEM> = {
4848
renderFoot?: () => ReactNode,
4949
className?: string,
5050
style?: React.CSSProperties,
51+
innerClassName?: string,
5152
} & Partial<typeof defaultProps>
5253

5354
export const defaultProps = {
@@ -234,7 +235,7 @@ export const VirtualList = forwardRef(function <ITEM>(
234235
//
235236
return <div ref={list} onScroll={handleScroll} className={props.className} style={{ overflow: 'auto', ...props.style }}>
236237
{props.renderHead?.()}
237-
<div ref={listInner} style={{ display: 'flex', flexDirection: 'column', ...(props.virtual && listInnerStyle) }}>
238+
<div ref={listInner} className={props.innerClassName} style={{ display: 'flex', flexDirection: 'column', ...(props.virtual && listInnerStyle) }}>
238239
{visible.map((item, i) => props.renderItem(item, visibleIndices[i]))}
239240
</div>
240241
{props.renderFoot?.()}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-base-virtual-list",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"license": "MIT",
55
"author": "phphe <phphe@outlook.com> (https://github.com/phphe)",
66
"description": "React base virtual list component.",
@@ -55,4 +55,4 @@
5555
"vite": "^5.0.8",
5656
"vite-plugin-dts": "^3.7.2"
5757
}
58-
}
58+
}

0 commit comments

Comments
 (0)