Skip to content

Commit

Permalink
feat: add renderTop element, corresponding to renderBottom (#9365)
Browse files Browse the repository at this point in the history
Co-authored-by: robin.li <[email protected]>
Co-authored-by: Li,Weitao <[email protected]>
  • Loading branch information
3 people authored May 26, 2021
1 parent 16831db commit 6cb81bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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

0 comments on commit 6cb81bf

Please sign in to comment.