Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
Detectando código de país para react-native-phone-number

Uso la biblioteca react-native-phone-number-input. Quiero que la bandera del país se determine automáticamente dependiendo de dónde soy. ¿Cómo implemento esto?

 <PhoneInput ref={phoneInput} defaultValue={value} // defaultCode="DM" layout="first" // onChangeText={(v) => setValue(v)} onChangeFormattedText={(v) => setValue(v)} placeholder={' '} defaultCode="IN" withDarkTheme withShadow autoFocus containerStyle={{ borderRadius: 0, width: '100%', height: 49, }} textInputStyle={{height: 68}} textContainerStyle={{paddingTop: 15}} />
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

puede establecer el país predeterminado en función de la IP, presionar API Geolocalización que devuelve el código de país o algo así. luego regresa a tus aplicaciones

about 4 years ago · Juan Pablo Isaza Report

0

El paquete react-native-localize se puede usar para obtener el código de país del dispositivo de los usuarios actuales, y supongo que esto se puede pasar a su componente PhoneNumber para mostrar la bandera del país correcta.

 import * as RNLocalize from "react-native-localize"; console.log(RNLocalize.getCountry()); // -> "FR"

Supongo que esto entonces funcionaría

 <PhoneInput ref={phoneInput} defaultValue={value} // defaultCode="DM" layout="first" // onChangeText={(v) => setValue(v)} onChangeFormattedText={(v) => setValue(v)} placeholder={' '} defaultCode={RNLocalize.getCountry()} withDarkTheme withShadow autoFocus containerStyle={{ borderRadius: 0, width: '100%', height: 49, }} textInputStyle={{height: 68}} textContainerStyle={{paddingTop: 15}} />
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!