import React, { useState } from 'react'; import { StyleSheet, View, Text, TouchableOpacity, Alert } from 'react-native'; import { Table, TableWrapper, Row, Col, Rows } from 'react-native-tabeller'; export const ExampleFive: React.FC = () => { const alertIndex = (value: string): void => { Alert.alert(`This is column ${value}`); }; const elementButton = (value: string): React.ReactElement => ( alertIndex(value)}> button ); const [tableHead] = useState([ '', elementButton('1'), elementButton('2'), elementButton('3'), ]); const [sideHead] = useState(['H1', 'H2']); const [rowTitles] = useState([ 'Title', 'Title2', 'Title3', 'Title4', ]); // Table data - matching the structure in the screenshot const [tableData] = useState([ ['a', '1', 'a'], ['b', '2', 'b'], ['c', '3', 'c'], ['d', '4', 'd'], ]); return ( {/* table header row with buttons */} {/* left column with H1, H2 */} {/* row titles column */} {/* content cells */}
); }; const styles = StyleSheet.create({ container: { flex: 1, padding: 16, paddingTop: 30, backgroundColor: '#fff', }, header: { height: 40, backgroundColor: '#fff', }, headerText: { textAlign: 'center', fontWeight: '500', }, wrapper: { flexDirection: 'row', }, sideHeader: { width: 60, backgroundColor: '#C6F3E0', }, sideHeaderText: { textAlign: 'center', fontWeight: '500', }, tableContentWrapper: { flex: 1, flexDirection: 'row', }, title: { width: 80, backgroundColor: '#f6f8fa', }, titleText: { textAlign: 'left', paddingLeft: 5, }, row: { height: 30, }, text: { textAlign: 'center', }, btn: { width: 58, height: 18, backgroundColor: '#c8e1ff', borderRadius: 2, alignSelf: 'center', }, btnText: { textAlign: 'center', fontSize: 12, }, }); export default ExampleFive;