From e52e1b1be03473e1f251e0cda18139435b4e6da7 Mon Sep 17 00:00:00 2001 From: Hope Tambala Date: Wed, 26 May 2021 21:48:58 -0400 Subject: [PATCH] fix: remove UI problem with asset supplementary form --- .../AssetFormSelect/index.js | 27 ++++++++++++++----- .../AssetFormSelect/index.style.js | 9 +++++++ .../NewAssets/AssetSupplementary/index.js | 13 +++------ 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/domains/DataCollection/Assets/NewAssets/AssetSupplementary/AssetFormSelect/index.js b/domains/DataCollection/Assets/NewAssets/AssetSupplementary/AssetFormSelect/index.js index fdc28b83d..a6c9f4efa 100644 --- a/domains/DataCollection/Assets/NewAssets/AssetSupplementary/AssetFormSelect/index.js +++ b/domains/DataCollection/Assets/NewAssets/AssetSupplementary/AssetFormSelect/index.js @@ -1,27 +1,42 @@ import React, { useEffect, useState } from 'react'; import { ScrollView, View } from 'react-native'; -import { Card, Text } from 'react-native-paper'; +import { Card, IconButton, Text } from 'react-native-paper'; import { assetFormsQuery } from '../../../../../../modules/cached-resources'; -import { layout } from '../../../../../../modules/theme'; +import { layout, theme } from '../../../../../../modules/theme'; import styles from './index.style'; -const AssetFormSelect = ({ setViewSupplementaryForms, setSelectedForm }) => { +const AssetFormSelect = ({ setSelectedForm }) => { const [assetForms, setAssetForms] = useState([]); useEffect(() => { assetFormsQuery().then((forms) => { setAssetForms(forms); }); - }, []); + }); + + const refreshAssetForms = () => { + assetFormsQuery().then((forms) => { + setAssetForms(forms); + }); + }; const selectForm = (form) => { - setViewSupplementaryForms(false); setSelectedForm(form); }; return ( - + + Supplementary Asset Forms + + + {assetForms && assetForms.map((form) => ( { - const [viewSupplementaryForms, setViewSupplementaryForms] = useState(false); const [selectedForm, setSelectedForm] = useState(); const [photoFile, setPhotoFile] = useState('State Photo String'); return ( @@ -70,14 +68,9 @@ const AssetSupplementary = ({ selectedAsset, surveyingOrganization }) => { - - {viewSupplementaryForms === true - && ( - - )} + {selectedAsset && (