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 React, { useEffect, useState } from 'react';
import { View, StyleSheet, ScrollView } from 'react-native'; import { View, StyleSheet, ScrollView } from 'react-native';
import { Table, TableWrapper, Row, Rows, Col } from 'react-native-table-component'; 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'; import client from '../screen/client/Client';
const userId = 1; const userId = 1;
// const [tableContent, setTableContent] = useState(); export default function App() {
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'],
], 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: { headers: {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
}).then((response) => { }).then((response) => {
CONTENT.tableData = response.data.data // CONTENT.tableData = response.data.data
console.log(CONTENT.tableData); setTableData({
console.log(CONTENT2.tableData); tableHead: ['Date', 'Time', 'Name', 'Result'],
data: response.data.data,
});
// console.log(CONTENT.tableData);
// userId = 5
// console.log(CONTENT2.tableData);
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });
} }
useEffect(() => {
getResult(userId);
}, []);
return ( return (
<ScrollView> <ScrollView>
<View style={styles.container}> <View style={styles.container}>
<Table borderStyle={{ borderWidth: 3, borderColor: '#fff' }}> <Table borderStyle={{ borderWidth: 5, borderColor: '#fff' }}>
<Row <Row
data={CONTENT.tableHead} data={tableData.tableHead}
flexArr={[1, 1, 1, 1]} flexArr={[1, 1, 1, 1]}
style={styles.head} style={styles.head}
textStyle={styles.text} textStyle={styles.text}
/> />
<TableWrapper style={styles.wrapper}> <TableWrapper style={styles.wrapper}>
<Rows <Rows
data={CONTENT2.tableData} data={tableData.data}
flexArr={[1, 1, 1, 1]} flexArr={[1, 1, 1, 1]}
style={styles.row} style={styles.row}
textStyle={styles.text} textStyle={styles.text}
......
...@@ -244,7 +244,7 @@ export default function Red({ navigation }) { ...@@ -244,7 +244,7 @@ export default function Red({ navigation }) {
const startRecording = async () => { const startRecording = async () => {
// setModalVisible(true); setModalVisible(true);
try { try {
await Voice.start('en-US'); 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