Skip to content
Discussion options

You must be logged in to vote

Okay... Now, I see where the problem comes from. The issue is that the value is considered an initial value (I cannot remember why, but it had a reason to do so), and it is only changed using a Form context of the Ant Design. So, when using React Form Hooks, please wrap the Antd Phone Input with the Antd Form as represented in the following example:

import React from "react";
import { useForm, Controller } from "react-hook-form";
import FormItem from "antd/lib/form/FormItem";
import Form from "antd/lib/form";
import PhoneInput from "antd-phone-input";

type FormValues = {
  phone: string;
};

export default function App() {
  const [form] = Form.useForm();
  const { control, handleSubmit,

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@Denys357
Comment options

@ArtyomVancyan
Comment options

@Denys357
Comment options

Comment options

You must be logged in to vote
1 reply
@Denys357
Comment options

Answer selected by Denys357
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants