From c44e5a3bfc8ab4f7e5de8fea41f0b68775677355 Mon Sep 17 00:00:00 2001 From: Pierre LHOSTE Date: Mon, 1 Jul 2024 15:33:45 +0200 Subject: [PATCH] Add error text for address --- src/navigation/store/NewDeliveryAddress.js | 29 ++++++++-------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/navigation/store/NewDeliveryAddress.js b/src/navigation/store/NewDeliveryAddress.js index fd33e1d84..8f1ac21a8 100644 --- a/src/navigation/store/NewDeliveryAddress.js +++ b/src/navigation/store/NewDeliveryAddress.js @@ -1,22 +1,14 @@ +import { AsYouType, parsePhoneNumberFromString } from 'libphonenumber-js'; import _ from 'lodash'; -import { Box, Button, Input, Text, VStack } from 'native-base'; +import { Input, Text } from 'native-base'; import React, { useState } from 'react'; import { withTranslation } from 'react-i18next'; -import { - KeyboardAvoidingView, - Platform, - SafeAreaView, - StyleSheet, - View, -} from 'react-native'; +import { Platform, StyleSheet, View } from 'react-native'; import { connect } from 'react-redux'; -import { AsYouType, parsePhoneNumberFromString } from 'libphonenumber-js'; - import AddressAutocomplete from '../../components/AddressAutocomplete'; - +import { Formik } from 'formik'; import { assertDelivery } from '../../redux/Store/actions'; import { selectStore } from '../../redux/Store/selectors'; -import { Formik } from 'formik'; import { useBackgroundContainerColor, useBackgroundHighlightColor, @@ -91,10 +83,7 @@ function NewDelivery(props) { } if (!validAddresses) { - errors.address = { - ...errors.address, - address: 'test', - }; + errors.address.address = props.t('STORE_NEW_DELIVERY_ADDRESS_HELP'); } if (_.isEmpty(errors.address)) { @@ -155,9 +144,6 @@ function NewDelivery(props) { {props.t('STORE_NEW_DELIVERY_ADDRESS')} {validAddresses && ' ✓'} - - {props.t('STORE_NEW_DELIVERY_ADDRESS_HELP')} - + {errors.address && touched.address && errors.address.address && ( + + {errors.address.address} + + )}