Commit 4f05db76 authored by W.D.R.P. Sandeepa's avatar W.D.R.P. Sandeepa

Merge branch 'it18218640' into 'master'

It18218640

See merge request !188
parents 956b3062 67fa76b1
import React, { useEffect, useState } from 'react';
import { View, StyleSheet, ScrollView } from 'react-native';
import { Table, TableWrapper, Row, Rows, Col } from 'react-native-table-component';
import AsyncStorage from '@react-native-async-storage/async-storage';
import client from '../screen/client/Client';
const userId = 1;
// const [tableContent, setTableContent] = useState();
const CONTENT = {
tableHead: ['Date', 'Time', 'Name', 'Result'],
tableData: [],
};
const CONTENT2 = {
tableHead: ['Date', 'Time', 'Name', 'Result'],
tableData: [
['1 jan 2022', '2s', 'Red', 'Good'],
['2 jan 2022', '2s', 'Green', 'Good'],
['3 jan 2022', '2s', 'Black', 'Good'],
['4 jan 2022', '2s', 'White', 'Good'],
['5 jan 2022', '2s', 'Blue', 'Good'],
['6 jan 2022', '2s', 'Yellow', 'Good'],
export default function App() {
],
};
const [tableData, setTableData] = useState({
tableHead: ['Date', 'Time', 'Name', 'Result'],
data: [],
});
export default function App() {
useEffect(() => {
getResult(userId);
}, []);
function getResult(userId) {
async function getResult(userId) {
client.get('getColorActivitiesResult/'+userId, {
await client.get('getColorActivitiesResult/' + userId, {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
}).then((response) => {
CONTENT.tableData = response.data.data
console.log(CONTENT.tableData);
console.log(CONTENT2.tableData);
// CONTENT.tableData = response.data.data
setTableData({
tableHead: ['Date', 'Time', 'Name', 'Result'],
data: response.data.data,
});
// console.log(CONTENT.tableData);
// userId = 5
// console.log(CONTENT2.tableData);
}).catch(err => {
console.log(err);
});
}
useEffect(() => {
getResult(userId);
}, []);
return (
<ScrollView>
<View style={styles.container}>
<Table borderStyle={{ borderWidth: 3, borderColor: '#fff' }}>
<Table borderStyle={{ borderWidth: 5, borderColor: '#fff' }}>
<Row
data={CONTENT.tableHead}
data={tableData.tableHead}
flexArr={[1, 1, 1, 1]}
style={styles.head}
textStyle={styles.text}
/>
<TableWrapper style={styles.wrapper}>
<Rows
data={CONTENT2.tableData}
data={tableData.data}
flexArr={[1, 1, 1, 1]}
style={styles.row}
textStyle={styles.text}
......
......@@ -244,7 +244,7 @@ export default function Red({ navigation }) {
const startRecording = async () => {
// setModalVisible(true);
setModalVisible(true);
try {
await Voice.start('en-US');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment