Skip to content

Commit c10a399

Browse files
committed
chore: improve active item example
1 parent 53d9c76 commit c10a399

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

example/src/ActiveItem.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import React, {memo, useState} from 'react';
1+
import React, {memo, useMemo, useState} from 'react';
22
import {ListRenderItemInfo} from 'react-native';
33

4+
import {faker} from '@faker-js/faker';
45
import ReorderableList, {
56
ReorderableListReorderEvent,
67
reorderItems,
@@ -13,7 +14,6 @@ import {
1314
ListItemProps,
1415
SeedDataItem,
1516
usePanGesture,
16-
useSeedData,
1717
} from './common';
1818

1919
export const ActiveItem: React.FC<ListItemProps> = memo(props => {
@@ -28,7 +28,24 @@ export const ActiveItem: React.FC<ListItemProps> = memo(props => {
2828
});
2929

3030
export const ActiveItemScreen = () => {
31-
const seedData = useSeedData();
31+
const seedData: SeedDataItem[] = useMemo(
32+
() =>
33+
faker.helpers.multiple(
34+
() => ({
35+
id: faker.string.uuid(),
36+
image: faker.image.urlPicsumPhotos({
37+
width: 50,
38+
height: 50,
39+
}),
40+
title: faker.book.title(),
41+
description: faker.book.genre(),
42+
}),
43+
{
44+
count: 20,
45+
},
46+
),
47+
[],
48+
);
3249
const [data, setData] = useState(seedData);
3350
const panGesture = usePanGesture();
3451

0 commit comments

Comments
 (0)