Skip to content

Commit

Permalink
fix: allow asset core to scroll entire height of device
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-mccombs committed Sep 14, 2021
1 parent f5127e9 commit 57593ed
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 61 deletions.
81 changes: 46 additions & 35 deletions domains/DataCollection/Assets/NewAssets/AssetCore/config/config.js
Original file line number Diff line number Diff line change
@@ -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;
43 changes: 19 additions & 24 deletions domains/DataCollection/Assets/NewAssets/AssetCore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ScrollView, View
} from 'react-native';
import {
Provider, /*Text/*,
Provider,Button /*Text/*,
TextInput*/
} from 'react-native-paper';

Expand All @@ -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: '' }]);
Expand All @@ -44,7 +44,8 @@ const AssetCore = ({ scrollViewScroll, setScrollViewScroll,

useEffect(() => {
setInputs(configArray);
}, [setInputs, configArray]);
}, [configArray]);


// const handleFormikPropsLocation = async (formikProps) => {
// setLocationLoading(true);
Expand Down Expand Up @@ -111,14 +112,10 @@ const AssetCore = ({ scrollViewScroll, setScrollViewScroll,
.catch((e) => console.log(e)); //eslint-disable-line
setSubmitting(false);
}}

>

{(formikProps) => (
<View style={styles.assetContainer}>

{inputs.length && inputs.map((result) => (

<View style={styles.assetContainer}>
{inputs.fields && inputs.fields.map((result) => (
<View key={result.formikKey}>
<PaperInputPicker
data={result}
Expand All @@ -127,15 +124,15 @@ const AssetCore = ({ scrollViewScroll, setScrollViewScroll,
scrollViewScroll={scrollViewScroll}
setScrollViewScroll={setScrollViewScroll}
customForm={false}
/>{console.log(result)}
/>
</View>
)
)}
))}
<ErrorPicker
formikProps={formikProps}
inputs={inputs}
inputs={inputs.fields}
/>
{submitting ? (

{submitting ? (
<ActivityIndicator />
) : (
<PaperButton
Expand All @@ -153,7 +150,13 @@ const AssetCore = ({ scrollViewScroll, setScrollViewScroll,
</View>

)}

</Formik>
</Provider>
</ScrollView>
);
};

export default AssetCore;
{/* {(formikProps) => (
<View style={styles.assetContainer}>
<View id="top">
Expand Down Expand Up @@ -244,11 +247,3 @@ const AssetCore = ({ scrollViewScroll, setScrollViewScroll,
</View>
)}*/ }
</Formik>
</Provider>

</ScrollView>
);
};

export default AssetCore;
5 changes: 3 additions & 2 deletions domains/DataCollection/Assets/NewAssets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const NewAsset = ({
selectedAsset={selectedAsset}
surveyingOrganization={surveyingOrganization}
surveyingUser={surveyingUser}
scrollViewScroll={setScrollViewScroll}
scrollViewScroll={scrollViewScroll}
setScrollViewScroll={setScrollViewScroll}
/>
</View>
<View key="2" style={styles.page}>
Expand All @@ -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',
Expand Down

0 comments on commit 57593ed

Please sign in to comment.