import React, { useState } from 'react'; import { StyleSheet, View, Text, TouchableOpacity, Alert } from 'react-native'; import { Table, TableWrapper, Row, Cell } from 'react-native-tabeller'; type TableDataType = string[][]; export const ExampleFour: React.FC = () => { const [tableHead] = useState(['Head', 'Head2', 'Head3', 'Head4']); const [tableData] = useState([ ['1', '2', '3', '4'], ['a', 'b', 'c', 'd'], ['1', '2', '3', '4'], ['a', 'b', 'c', 'd'], ]); const alertIndex = (index: number): void => { Alert.alert(`This is row ${index + 1}`); }; const element = (data: any, index: number): React.ReactElement => ( alertIndex(index)}> button ); return ( {tableData.map((rowData, index) => ( {rowData.map((cellData, cellIndex) => ( ))} ))}
); }; const styles = StyleSheet.create({ container: { flex: 1, padding: 16, paddingTop: 30, backgroundColor: '#fff' }, head: { height: 40, backgroundColor: '#C6F3E0' }, text: { margin: 8 }, row: { flexDirection: 'row', backgroundColor: '#FFF1C1' }, btn: { width: 58, height: 18, backgroundColor: '#78B7BB', borderRadius: 2 }, btnText: { textAlign: 'center', color: '#fff' }, }); export default ExampleFour;