Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

106
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda