Move files to lib folder
This commit is contained in:
parent
d8d8ac35f8
commit
cec664c8d0
26 changed files with 58 additions and 59 deletions
31
lib/components/List.tsx
Normal file
31
lib/components/List.tsx
Normal file
|
@ -0,0 +1,31 @@
|
|||
import React from 'react';
|
||||
import {ViewStyle} from 'react-native';
|
||||
import {ThemedView} from '@/components/ThemedView';
|
||||
|
||||
interface ListProps {
|
||||
data: any;
|
||||
renderItem: Function;
|
||||
viewStyle?: ViewStyle;
|
||||
}
|
||||
|
||||
const CustomList: React.FC<ListProps> = ({ data, renderItem, viewStyle }) => {
|
||||
const renderList = () => {
|
||||
let list: any[] = [];
|
||||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const item = data[i];
|
||||
|
||||
list[i] = renderItem(item, i);
|
||||
}
|
||||
|
||||
return list;
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemedView style={viewStyle ? viewStyle : undefined}>
|
||||
{renderList()}
|
||||
</ThemedView>
|
||||
);
|
||||
};
|
||||
|
||||
export default CustomList;
|
Loading…
Add table
Add a link
Reference in a new issue