rc-virtual-list
Advanced tools
Comparing version 0.0.0-alpha.3 to 0.0.0-alpha.4
import * as React from 'react'; | ||
declare type RenderFunc<T> = (item: T, index: number) => React.ReactNode; | ||
declare type RenderFunc<T> = (item: T, index: number, props: { | ||
style: React.CSSProperties; | ||
}) => React.ReactNode; | ||
export interface RelativeScroll { | ||
@@ -4,0 +6,0 @@ itemIndex: number; |
@@ -171,18 +171,22 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
_this.renderChildren = function (list, startIndex, renderFunc) { | ||
return (// We should measure rendered item height | ||
list.map(function (item, index) { | ||
var eleIndex = startIndex + index; | ||
var node = renderFunc(item, eleIndex); | ||
var status = _this.state.status; // We should measure rendered item height | ||
var eleKey = _this.getIndexKey(eleIndex); // Pass `key` and `ref` for internal measure | ||
return list.map(function (item, index) { | ||
var eleIndex = startIndex + index; | ||
var node = renderFunc(item, eleIndex, { | ||
style: status === 'MEASURE_START' ? { | ||
visibility: 'hidden' | ||
} : {} | ||
}); | ||
var eleKey = _this.getIndexKey(eleIndex); // Pass `key` and `ref` for internal measure | ||
return React.cloneElement(node, { | ||
key: eleKey, | ||
ref: function ref(ele) { | ||
_this.itemElements[eleKey] = ele; | ||
} | ||
}); | ||
}) | ||
); | ||
return React.cloneElement(node, { | ||
key: eleKey, | ||
ref: function ref(ele) { | ||
_this.itemElements[eleKey] = ele; | ||
} | ||
}); | ||
}); | ||
}; | ||
@@ -189,0 +193,0 @@ |
import * as React from 'react'; | ||
declare type RenderFunc<T> = (item: T, index: number) => React.ReactNode; | ||
declare type RenderFunc<T> = (item: T, index: number, props: { | ||
style: React.CSSProperties; | ||
}) => React.ReactNode; | ||
export interface RelativeScroll { | ||
@@ -4,0 +6,0 @@ itemIndex: number; |
@@ -186,18 +186,22 @@ "use strict"; | ||
_this.renderChildren = function (list, startIndex, renderFunc) { | ||
return (// We should measure rendered item height | ||
list.map(function (item, index) { | ||
var eleIndex = startIndex + index; | ||
var node = renderFunc(item, eleIndex); | ||
var status = _this.state.status; // We should measure rendered item height | ||
var eleKey = _this.getIndexKey(eleIndex); // Pass `key` and `ref` for internal measure | ||
return list.map(function (item, index) { | ||
var eleIndex = startIndex + index; | ||
var node = renderFunc(item, eleIndex, { | ||
style: status === 'MEASURE_START' ? { | ||
visibility: 'hidden' | ||
} : {} | ||
}); | ||
var eleKey = _this.getIndexKey(eleIndex); // Pass `key` and `ref` for internal measure | ||
return React.cloneElement(node, { | ||
key: eleKey, | ||
ref: function ref(ele) { | ||
_this.itemElements[eleKey] = ele; | ||
} | ||
}); | ||
}) | ||
); | ||
return React.cloneElement(node, { | ||
key: eleKey, | ||
ref: function ref(ele) { | ||
_this.itemElements[eleKey] = ele; | ||
} | ||
}); | ||
}); | ||
}; | ||
@@ -204,0 +208,0 @@ |
{ | ||
"name": "rc-virtual-list", | ||
"version": "0.0.0-alpha.3", | ||
"version": "0.0.0-alpha.4", | ||
"description": "React Virtual List Component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -50,10 +50,13 @@ # rc-virtual-list | ||
| Prop | Description | Type | Default | | ||
| ---------- | ------------------------------------------------------- | -------------------- | ------- | | ||
| children | Render props of item | item => ReactElement | - | | ||
| component | Customize List dom element | string \| Component | div | | ||
| data | Data list | Array | - | | ||
| disabled | Disable scroll check. Usually used on animation control | boolean | false | | ||
| height | List height | number | - | | ||
| itemHeight | Item minium height | number | - | | ||
| itemKey | Match key with item | string | - | | ||
| Prop | Description | Type | Default | | ||
| ---------- | ------------------------------------------------------- | ------------------------------------ | ------- | | ||
| children | Render props of item | (item, index, props) => ReactElement | - | | ||
| component | Customize List dom element | string \| Component | div | | ||
| data | Data list | Array | - | | ||
| disabled | Disable scroll check. Usually used on animation control | boolean | false | | ||
| height | List height | number | - | | ||
| itemHeight | Item minium height | number | - | | ||
| itemKey | Match key with item | string | - | | ||
`children` provides additional `props` argument to support IE 11 scroll shaking. | ||
It will set `style` to `visibility: hidden` when measuring. You can ignore this if no requirement on IE. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78764
1747
62