ordering-ui-react-native 0.24.4 → 0.24.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.24.4",
3
+ "version": "0.24.5",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -76,6 +76,8 @@ const AddressFormUI = (props: AddressFormParams) => {
76
76
 
77
77
  const [autoCompleteInputFocused, setAutoCompleteInputFocused] = useState(false)
78
78
 
79
+ const isEmptyField = (key: any, str: any) => isRequiredField && isRequiredField(key) && (!str || str.trim().length === 0)
80
+
79
81
  const tagsName = [
80
82
  { icon: theme.images.general.tag_home, value: 'home' },
81
83
  { icon: theme.images.general.tag_building, value: 'office' },
@@ -748,9 +750,9 @@ const AddressFormUI = (props: AddressFormParams) => {
748
750
  <OInput
749
751
  name="internal_number"
750
752
  placeholder={t('INTERNAL_NUMBER', 'Internal number')}
751
- onChange={(text: string) => {
752
- handleChangeInput(text);
753
- setValue('internal_number', text);
753
+ onChange={(data: any) => {
754
+ handleChangeInput(data);
755
+ setValue('internal_number', isEmptyField('internal_number', data?.target?.value) ? null : data);
754
756
  }}
755
757
  value={
756
758
  address?.internal_number ||
@@ -795,9 +797,9 @@ const AddressFormUI = (props: AddressFormParams) => {
795
797
  <OInput
796
798
  name="zipcode"
797
799
  placeholder={t('ZIP_CODE', 'Zip code')}
798
- onChange={(text: string) => {
799
- handleChangeInput(text);
800
- setValue('zipcode', text);
800
+ onChange={(data: any) => {
801
+ handleChangeInput(data);
802
+ setValue('zipcode', isEmptyField('zipcode', data?.target?.value) ? null : data);
801
803
  }}
802
804
  value={
803
805
  address?.zipcode ||