From 57593edead08fb1715ecdecf25f7afcf5a7a9c49 Mon Sep 17 00:00:00 2001 From: Joseph McCombs Date: Mon, 13 Sep 2021 22:29:39 -0400 Subject: [PATCH] fix: allow asset core to scroll entire height of device --- .../NewAssets/AssetCore/config/config.js | 81 +++++++++++-------- .../Assets/NewAssets/AssetCore/index.js | 43 +++++----- .../DataCollection/Assets/NewAssets/index.js | 5 +- 3 files changed, 68 insertions(+), 61 deletions(-) diff --git a/domains/DataCollection/Assets/NewAssets/AssetCore/config/config.js b/domains/DataCollection/Assets/NewAssets/AssetCore/config/config.js index a374ef98f..9a5ee127f 100644 --- a/domains/DataCollection/Assets/NewAssets/AssetCore/config/config.js +++ b/domains/DataCollection/Assets/NewAssets/AssetCore/config/config.js @@ -1,42 +1,53 @@ -const configArray = [ - { - label: 'assetCore.nameOfAssets', - formikKey: '', - value: '', - fieldType: 'input', - validation: false - }, - { - label: 'assetCore.getLocation', - formikKey: 'location', - value: {}, - fieldType: 'geolocation', - validation: false - }, - { - label: 'global.commName', - formikKey: 'communityname', - value: '', - fieldType: 'autofill', - parameter: 'Communities', - validation: false - }, - { - label: 'identificationForm.province', - formikKey: 'province', +const configArray = { + class: 'Assets', + name: 'Asset', + customForm: false, + fields: [ + { + label: 'New Asset', + // add translation + fieldType: 'header', + formikKey: 'none_bi', + }, + { + label: 'assetCore.nameOfAssets', + formikKey: 'name', + value: '', + fieldType: 'input', + validation: false + }, + { + label: 'assetCore.getLocation', + formikKey: 'location', + value: {}, + fieldType: 'geolocation', + validation: false + }, + { + label: 'global.commName', + formikKey: 'communityname', value: '', fieldType: 'autofill', - parameter: 'Province', + parameter: 'Communities', validation: false }, { - label: 'assetCore.country', - formikKey: 'country', - value: '', - fieldType: 'autofill', - parameter: 'Country', - validation: false - } -]; + label: 'identificationForm.province', + formikKey: 'province', + value: '', + fieldType: 'autofill', + parameter: 'Province', + validation: false + }, + { + label: 'assetCore.country', + formikKey: 'country', + value: '', + fieldType: 'autofill', + parameter: 'Country', + validation: false + } + ] +}; export default configArray; \ No newline at end of file diff --git a/domains/DataCollection/Assets/NewAssets/AssetCore/index.js b/domains/DataCollection/Assets/NewAssets/AssetCore/index.js index 6eaf78a82..23871a825 100644 --- a/domains/DataCollection/Assets/NewAssets/AssetCore/index.js +++ b/domains/DataCollection/Assets/NewAssets/AssetCore/index.js @@ -6,7 +6,7 @@ import { ScrollView, View } from 'react-native'; import { - Provider, /*Text/*, + Provider,Button /*Text/*, TextInput*/ } from 'react-native-paper'; @@ -26,11 +26,11 @@ import styles from './index.styles'; import { layout, theme } from '../../../../../modules/theme'; import configArray from './config/config'; -const AssetCore = ({ scrollViewScroll, setScrollViewScroll, +const AssetCore = ({ setSelectedAsset, scrollViewScroll, setScrollViewScroll, /*setSelectedForm, setSurveyee,*/ surveyingUser, surveyingOrganization }) => { useEffect(() => { - setValidationSchema(yupValidationPicker(configArray)); + setValidationSchema(yupValidationPicker(configArray.fields)); }, []); const [people, setPeople] = useState([{ firstName: '', lastName: '' }]); @@ -44,7 +44,8 @@ const AssetCore = ({ scrollViewScroll, setScrollViewScroll, useEffect(() => { setInputs(configArray); - }, [setInputs, configArray]); + }, [configArray]); + // const handleFormikPropsLocation = async (formikProps) => { // setLocationLoading(true); @@ -111,14 +112,10 @@ const AssetCore = ({ scrollViewScroll, setScrollViewScroll, .catch((e) => console.log(e)); //eslint-disable-line setSubmitting(false); }} - > - {(formikProps) => ( - - - {inputs.length && inputs.map((result) => ( - + + {inputs.fields && inputs.fields.map((result) => ( {console.log(result)} + /> - ) - )} + ))} - {submitting ? ( + + {submitting ? ( ) : ( )} - + + + + ); +}; + +export default AssetCore; {/* {(formikProps) => ( @@ -244,11 +247,3 @@ const AssetCore = ({ scrollViewScroll, setScrollViewScroll, )}*/ } - - - - - ); -}; - -export default AssetCore; diff --git a/domains/DataCollection/Assets/NewAssets/index.js b/domains/DataCollection/Assets/NewAssets/index.js index 99defb7ad..8cc4bb617 100644 --- a/domains/DataCollection/Assets/NewAssets/index.js +++ b/domains/DataCollection/Assets/NewAssets/index.js @@ -17,7 +17,8 @@ const NewAsset = ({ selectedAsset={selectedAsset} surveyingOrganization={surveyingOrganization} surveyingUser={surveyingUser} - scrollViewScroll={setScrollViewScroll} + scrollViewScroll={scrollViewScroll} + setScrollViewScroll={setScrollViewScroll} /> @@ -36,7 +37,7 @@ const styles = StyleSheet.create({ viewPager: { flex: 1, width: Dimensions.get('window').width, - height: Dimensions.get('window').height * 0.65, + height: Dimensions.get('window').height, }, page: { justifyContent: 'center',