Skip to content

Commit

Permalink
randomStr added
Browse files Browse the repository at this point in the history
  • Loading branch information
kanzitelli committed Oct 20, 2022
1 parent 60522e9 commit a6205bd
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions src/screens/playground.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import React, {useMemo} from 'react';
import React from 'react';
import {Text, View} from 'react-native-ui-lib';
import {ScreenComponent} from 'rnn-screens';
import {FlashList} from '@shopify/flash-list';
import FastImage from 'react-native-fast-image';
import {observer} from 'mobx-react';

const generateListItemDescription = (len: number) => {
const characters =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = ' ';
const charactersLength = characters.length;
for (let i = 0; i < len; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}

return result;
};
import {randomStr} from '../utils/help';

export const Playground: ScreenComponent = observer(() => {
// const {t} = useServices();
Expand All @@ -24,22 +13,13 @@ export const Playground: ScreenComponent = observer(() => {
const DATA = Array.from({length: 1000}).map((v, ndx) => ({
title: `Item ${ndx}`,
image: `https://picsum.photos/200?image=${ndx + 1}`,
description: generateListItemDescription(300),
description: randomStr(300),
}));

// State

// Methods
// UI Methods
const ListHeaderBlock = useMemo(() => {
return (
<View padding-s2 bg-bgColor>
<Text text50M textColor>
FlashList by Shopify
</Text>
</View>
);
}, []);

return (
<FlashList
Expand All @@ -61,7 +41,13 @@ export const Playground: ScreenComponent = observer(() => {
</Text>
</View>
)}
ListHeaderComponent={ListHeaderBlock}
ListHeaderComponent={
<View padding-s2 bg-bgColor>
<Text text50M textColor>
FlashList by Shopify
</Text>
</View>
}
estimatedItemSize={300}
/>
);
Expand Down

0 comments on commit a6205bd

Please sign in to comment.