Skip to content

Commit

Permalink
fix: location being parsed from formik Fiekd
Browse files Browse the repository at this point in the history
  • Loading branch information
hopetambala committed Oct 23, 2020
1 parent d7bbbca commit c8ecceb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions components/FormikFields/PaperInputPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const PaperInputPicker = ({

setFieldValue('location', { latitude, longitude, altitude });
setLocation({ latitude, longitude, altitude });
return null;
};

return (
Expand Down Expand Up @@ -72,7 +71,7 @@ const PaperInputPicker = ({
<Text style={layout.selectLabel}>{label}</Text>
<View style={layout.buttonGroupContainer}>
{data.options.map((result) => (
<View>
<View key={result.value}>
{/* selected value */}
{result.value === values[formikKey] && (
<Button
Expand Down
6 changes: 5 additions & 1 deletion domains/DataCollection/Forms/IdentificationForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ const IdentificationForm = ({
const formObject = values;
formObject.surveyingOrganization = surveyingOrganization;
formObject.surveyingUser = surveyingUser;
formObject.latitude = values.location.latitude;
formObject.longitude = values.location.longitude;
formObject.altitude = values.location.altitude;

formObject.dob = `${values.Month || '00'}/${values.Day || '00'}/${values.Year || '0000'}`;

const valuesToPrune = ['Month', 'Day', 'Year'];
const valuesToPrune = ['Month', 'Day', 'Year', 'location'];
valuesToPrune.forEach((value) => {
delete formObject[value];
});
Expand Down

0 comments on commit c8ecceb

Please sign in to comment.