Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add renderTop element, corresponding to renderBottom #9365

Merged
merged 4 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ export default function createListComponent ({
useIsScrolling,
width,
position,
renderTop,
renderBottom,
...rest
} = this.props
Expand Down Expand Up @@ -546,6 +547,7 @@ export default function createListComponent ({
if (position === 'relative') {
const pre = getItemOffset(this.props, startIndex, this)
return createElement(outerElementType || outerTagName || 'div', outerElementProps,
renderTop,
createElement(itemElementType || itemTagName || 'div', {
key: `${id}-pre`,
id: `${id}-pre`,
Expand All @@ -566,6 +568,7 @@ export default function createListComponent ({
)
} else {
return createElement(outerElementType || outerTagName || 'div', outerElementProps,
renderTop,
createElement(innerElementType || innerTagName || 'div', {
ref: innerRef,
key: `${id}-inner`,
Expand Down
2 changes: 2 additions & 0 deletions packages/taro-components/virtual-list/react/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ interface VirtualListProps extends StandardProps {
initialScrollOffset?: number
/** 列表内部容器组件类型,默认值为 View。 */
innerElementType?: ComponentType
/** 顶部区域 */
renderTop?: ReactNode
/** 底部区域 */
renderBottom?: ReactNode
/** 滚动方向。vertical 为垂直滚动,horizontal 为平行滚动。默认为 vertical。 */
Expand Down