Skip to content

Commit a4cb1c4

Browse files
committed
docs: Update demo
1 parent 36bbc91 commit a4cb1c4

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

examples/animate.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,14 @@ const MyItem: React.ForwardRefRenderFunction<any, MyItemProps> = (
8484
onLeave(id);
8585
}}
8686
>
87-
{({ className, style }, motionRef) => {
87+
{({ className, style }, passedMotionRef) => {
8888
return (
89-
<div ref={motionRef} className={classNames('item', className)} style={style} data-id={id}>
89+
<div
90+
ref={passedMotionRef}
91+
className={classNames('item', className)}
92+
style={style}
93+
data-id={id}
94+
>
9095
<div style={{ height: itemUuid % 2 ? 100 : undefined }}>
9196
<button
9297
type="button"

examples/basic.less

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.fixed-item {
2+
border: 1px solid gray;
3+
padding: 0 16px;
4+
height: 32px;
5+
line-height: 30px;
6+
box-sizing: border-box;
7+
display: inline-block;
8+
}

examples/basic.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for */
22
import * as React from 'react';
33
import List, { ListRef } from '../src/List';
4+
import './basic.less';
45

56
interface Item {
67
id: string;
@@ -9,15 +10,10 @@ interface Item {
910
const MyItem: React.ForwardRefRenderFunction<any, Item> = ({ id }, ref) => (
1011
<span
1112
ref={ref}
12-
style={{
13-
border: '1px solid gray',
14-
padding: '0 16px',
15-
// height: 30 + (id % 2 ? 0 : 10),
16-
height: 32,
17-
lineHeight: '30px',
18-
boxSizing: 'border-box',
19-
display: 'inline-block',
20-
}}
13+
// style={{
14+
// // height: 30 + (id % 2 ? 0 : 10),
15+
// }}
16+
className="fixed-item"
2117
onClick={() => {
2218
console.log('Click:', id);
2319
}}
@@ -37,7 +33,7 @@ class TestItem extends React.Component<Item, {}> {
3733
}
3834

3935
const data: Item[] = [];
40-
for (let i = 0; i < 100000; i += 1) {
36+
for (let i = 0; i < 1000; i += 1) {
4137
data.push({
4238
id: String(i),
4339
});

0 commit comments

Comments
 (0)