mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-04-12 15:40:30 +08:00
Merge pull request #1835 from lowdefy/phone-input
PhoneNumberInput - undefined (reading 'dial_code')
This commit is contained in:
commit
6f8bd27d9e
5
.changeset/violet-papayas-breathe.md
Normal file
5
.changeset/violet-papayas-breathe.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'@lowdefy/blocks-antd': patch
|
||||
---
|
||||
|
||||
Fix undefined property access in PhoneNumberInput component
|
@ -73,9 +73,9 @@ function AddOnSelect({
|
||||
mode="single"
|
||||
notFoundContent={'Not found'}
|
||||
onChange={(newVal) => {
|
||||
const input = value?.input;
|
||||
const region = uniqueValueOptions[newVal].value;
|
||||
const phone_number = `${region.dial_code}${input}`;
|
||||
const input = value?.input ?? '';
|
||||
const region = uniqueValueOptions[newVal]?.value ?? {};
|
||||
const phone_number = `${region?.dial_code ?? ''}${input}`;
|
||||
|
||||
methods.setValue({
|
||||
input,
|
||||
@ -207,8 +207,8 @@ const PhoneNumberInput = ({
|
||||
input = input.replace(regex, properties.replaceInput.replacement ?? '');
|
||||
}
|
||||
|
||||
const region = value.region;
|
||||
const phone_number = `${region.dial_code}${input}`;
|
||||
const region = value?.region ?? {};
|
||||
const phone_number = `${region?.dial_code ?? ''}${input}`;
|
||||
|
||||
methods.setValue({
|
||||
input,
|
||||
|
Loading…
x
Reference in New Issue
Block a user