Category view + detail
This commit is contained in:
parent
5ebd10cd3a
commit
aaedcec4a6
8 changed files with 3360 additions and 1599 deletions
29
components/List.tsx
Normal file
29
components/List.tsx
Normal file
|
@ -0,0 +1,29 @@
|
|||
import {StyleSheet, View} from 'react-native';
|
||||
import React from 'react';
|
||||
|
||||
interface ListProps {
|
||||
data: any;
|
||||
renderItem: Function;
|
||||
}
|
||||
|
||||
const CustomList: React.FC<ListProps> = ({ data, renderItem }) => {
|
||||
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 (
|
||||
<View>
|
||||
{renderList()}
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
export default CustomList;
|
Loading…
Add table
Add a link
Reference in a new issue