Javascript 反应最终形式不';不接受自定义输入值

Javascript 反应最终形式不';不接受自定义输入值,javascript,reactjs,react-final-form,Javascript,Reactjs,React Final Form,我有以下代码: ... return ( <FormItem key={name}> <Label htmlFor={id}>{camelCaseToTitleCase(fieldKey)}</Label> { fieldKey === 'homePhone' ? <Field name={`${key}.${

我有以下代码:

...
      return (
        <FormItem key={name}>
          <Label htmlFor={id}>{camelCaseToTitleCase(fieldKey)}</Label>
          {
            fieldKey === 'homePhone' 
            ?
              <Field name={`${key}.${fieldKey}.value`} validate={validate(fieldKey)}>
                {props => 
                  (
                    <>
                    <PhoneNumberInput
                      disabled={disabled}
                      data-bdd={`customer_details_field_${fieldKey}`}
                      id={id}
                      value={props.input.value}
                      // onChange={(val: string):any => console.log(val)}
                      {...props}
                    />
                    </>
                  )
                }
              </Field>
...
。。。
返回(
{camelCaseToTitleCase(字段键)}
{
fieldKey==='homePhone'
?
{props=>
(
console.log(val)}
{…道具}
/>
)
}
...
其中phoneinput是:

const PhoneNumberInput: React.FC<PhoneNumberInputProps> = (props) => {
  const {
    disabled,
    id,
    label,
    value
  } = props

  const [updatedValue, setUpdatedValue] = useState(value)
  const DEFAULT_COUNTRY_VALUE = 'GB'

  const handleONChange = (val: string) => {
    setUpdatedValue(val)
  }

  return (
    <>
      <Label htmlFor={id}>{label}</Label>
      <PhoneInput
        disabled={disabled}
        id={id}
        defaultCountry={DEFAULT_COUNTRY_VALUE}
        value={updatedValue}
        onChange={(phone: string) => handleONChange(phone)}
      />
      value: {updatedValue}
    </>
  )
}
constPhoneNumberInput:React.FC=(道具)=>{
常数{
残废
身份证件
标签,
价值
}=道具
常量[updatedValue,setUpdatedValue]=useState(值)
常量默认值\国家\值='GB'
const handleONChange=(val:string)=>{
setUpdatedValue(val)
}
返回(
{label}
手机(电话)}
/>
值:{updatedValue}
)
}
当我提交表单时,
PhoneNumberInput
中的值仍然来自
props.input.value
,并且不反映
value:{updatedValue}
中正在更新的内容

phoneInput组件确实显示更新的值,但在提交发件人时不会发送相同的值


以+44开头的值是我希望发送给我的BE的值,但它仍然发送
props.input.value

使phoneInput组件成为字段的一个组件,如下所示:

<Field
  name={`${key}.${fieldKey}.value`}
  validate={validate(fieldKey)}
  component={phoneInput}
  disabled={disabled}
  data-bdd={`customer_details_field_${fieldKey}`}
  id={id}
/>


它会自动将道具传递给组件

愚蠢的我,我忘了更新onChange:

<PhoneNumberInput
  disabled={disabled}
  data-bdd={`customer_details_field_${fieldKey}`}
  id={id}
  value={props.input.value}
  onChange={props.input.onChange}
  {...props}