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

159
Vistas
Prevent pressing dot key in React Native numeric type keyboard

I developed an application where user can enter their mobile numbers and I want to prevent users from pressing the dot and dash key, How can I achieve it?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

you can use react-phone-number-input

import React, { useState } from 'react'
import PhoneInput from 'react-phone-number-input/react-native-input'

function Example() {
  const [value, setValue] = useState()
  return (
    <PhoneInput
      style={...}
      defaultCountry="US"
      value={value}
      onChange={setValue} />
  )
}

see here demo

To display number phone you can use formater


import { formatPhoneNumber } from 'react-phone-number-input'
formatPhoneNumber('+12133734253') === '(213) 373-4253'

then put in text

<Text>
  {formatPhoneNumber('+12133734253')}
</Text>
about 4 years ago · Juan Pablo Isaza Denunciar

0

For the sake of not integrating a third party package just to check the phone number, you can simply create a regex that matches dot and dash keys and show a message "Please don't use "-" and "." while users are entering their phone number. This solution will provide more space for you to tweak things later if the needs from this component changes.

about 4 years ago · Juan Pablo Isaza Denunciar
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