Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

111
Visualizações
how to reset the phone number text field when you change the country code

in react phone input one property is there international that helps but in react phone input 2 this property is not working. In the react phone input 2 if you want to change the country code after filling the all digit then country code is changed but remaining digit are not removed automatically, in react phone number its was happening automatically. as for example if you given 91-9787890000 then if you change the code 91(India) to 852(Hong Kong) then its should look like 852 in phone text field but now its give 85297878900 how to reset those digit this should happen

now i get now this is happening

import React, { useState } from "react";
import PhoneInput from "react-phone-input-2";
import "react-phone-input-2/lib/material.css";
export default function DropDown() {
  const [fields1, setFields1] = useState([{ value: null }]);
  function handleChange(i, event) {
    if (event) {
      let values = [...fields1];
      values[i].value = event;
      setFields1((v) => values);
    }
  }
  return (
    <div className="App">
        {fields1.map((field, idx) => (
      <PhoneInput
        country={"in"}
        key={idx}
       localization={'in'}
        enableSearch
        disableSearchIcon={false}
        specialLabel=""
        autoComplete="off"
        value={field.value || ""}
        onChange={(e) => {handleChange(idx, e);}}
      />
      ))}
    </div>
  );
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda