Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-virtual-list

Package Overview
Dependencies
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-virtual-list - npm Package Compare versions

Comparing version 0.0.0-alpha.3 to 0.0.0-alpha.4

4

es/List.d.ts
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.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc