diff --git a/src/component/App.tsx b/src/component/App.tsx index 672b9bc..5a2fc5d 100644 --- a/src/component/App.tsx +++ b/src/component/App.tsx @@ -112,6 +112,10 @@ const App: React.FC = () => { // console.log(res.rows); if (len === 0) { + setTableData({ + header: ['no data'], + rows: [[]], + }); setLoaderVisibility(false); Snackbar.show({text: 'Query Executed!'}); return; diff --git a/src/component/Table.tsx b/src/component/Table.tsx index f226dd2..568fcb8 100644 --- a/src/component/Table.tsx +++ b/src/component/Table.tsx @@ -18,6 +18,15 @@ interface Props { const DataTable: FC = ({header, rows, tableWidths}) => { const styles = useDynamicValue(dynamicStyles); + + if (header[0] === 'no data') { + return ( + + Your query returned zero results + + ); + } + return ( <> Output @@ -26,8 +35,7 @@ const DataTable: FC = ({header, rows, tableWidths}) => { testID="table" accessibilityLabel="output table" horizontal={true} - bounces={false} - > + bounces={false}> @@ -77,4 +85,13 @@ const dynamicStyles = new DynamicStyleSheet({ marginTop: 10, width: '100%', }, + noResultsMessage: { + textAlign: 'center', + fontSize: 18, + marginTop: 100, + color: 'black', + backgroundColor: '#ffea00', + fontWeight: 'bold', + padding: 10, + }, });