1.0.9 • Published 3 years ago
simple-react-native-table v1.0.9
����# react-native-tableview
The TableView component is for outputting data in table format. The following constitute the props for the TableView Component:
- title - title for the table, default is Data Table,
- titleColor - color of title text, default is dodgerblue,
- defaultColor- the default color for general use in the table eg in horizontal lines. Default is dodgerblue,
data - the data to show in the table eg, { firstName: "Test 1 Firstname", lastName: "Test 1 Lastname", age: 5, }, { firstName: "Test 2 Firstname", lastName: "Test 2 Lastname", age: 30, }, { firstName: "Test 3 Firstname", lastName: "Test 3 Lastname", age: 45, }...
headers - the array of header objects with field names as in data in the form: { field: "firstName", title: "First Name", size: "34%" }, { field: "lastName", title: "Last Name", size: "33%" }, { field: "age", title: "Age", size: "33%" }
- the size is the width of the column relative to other columns(expressed as a %)
- title becomes the column header
- field is the key to extract data, example: celldata=datafield
- paginate - flag to determine whether to show pagination controls, defaults to true,
- setItemsPerPage - the function to set itemPerPage value (implement using useState hook),,
- setPage - the function to set page value (implement using useState hook),
- page - the initial page to render, default is 0.
- itemsPerPage - initial number of items per page. Preferably on of the elements of pageOptions,
- pageOptions - the array of number of Items per page options eg 5,10,20,
- headerColor - color of the headers, default is dodgerblue.
- firstColumnColor - color to apply to first column text, default is dodgerblue.
- footerColor - color to apply to footer component text, default is "dodgerblue".
- highlightRows - prop to highlight rows and make stripped table, default is true.
- highlightColumns - prop to highlight column backgrounds, only visible in the header, default is false
- padding - the horizontal padding that separates cells ie. separates columns
- alignColumns - alignment style for all other columns except first column, defaiult is "center".
- alignFirstColumn -alignment style for first column contents, default is "flex-start".
EXAMPLE