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

557
Views
React Native: Async and Await es un error de palabra reservado dentro de onPress

Estoy enfrentando un problema extraño. En mi aplicación nativa de reacción, tengo un botón de Googlebutton que activa onPress y verificará la condición dentro de él, pero el problema es que tengo una palabra reservada en await que me devuelve un error que dice Unexpected reserved word await . Estoy tratando de aplicar Pincode

Código principal

 import PINCode, {hasUserSetPinCode,resetPinCodeInternalStates,deleteUserPinCode, } from "@haskkor/react-native-pincode"; <GoogleSigninButton style={{ width: 252, height: 58 }} size={GoogleSigninButton.Size.Wide} color={GoogleSigninButton.Color.Dark} onPress={() => { const hasPin = await hasUserSetPinCode(); if (fingerprint === true) { googleLogin(); } else if (hasPin) { console.log("Alert pinnn should pop up"); } else { console.log("Alert should pop up"); setModalVisible(true); } } } />

Esto es lo que probé. Puse async (hasUserSetPinCode) antes de esperar, pero no devuelve ningún valor en mi consola, parece que no funciona.

poniendo un asíncrono

 import PINCode, {hasUserSetPinCode,resetPinCodeInternalStates,deleteUserPinCode, }from "@haskkor/react-native-pincode"; <GoogleSigninButton style={{ width: 252, height: 58 }} size={GoogleSigninButton.Size.Wide} color={GoogleSigninButton.Color.Dark} onPress={async() => { /* ------------------ The async below Doesn't work ----------------------------------- */ const hasPin = await hasUserSetPinCode(); if (fingerprint === true) { googleLogin(); } else if (hasPin) { console.log("Alert pinnn should pop up"); } else { console.log("Alert should pop up"); setModalVisible(true); } } />

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Coloque async antes de la función en la que se utiliza.

 import PINCode, {hasUserSetPinCode,resetPinCodeInternalStates,deleteUserPinCode, } from "@haskkor/react-native-pincode"; <GoogleSigninButton style={{ width: 252, height: 58 }} size={GoogleSigninButton.Size.Wide} color={GoogleSigninButton.Color.Dark} onPress={async () => { const hasPin = await hasUserSetPinCode(); if (fingerprint === true) { googleLogin(); } else if (hasPin) { console.log("Alert pinnn should pop up"); } else { console.log("Alert should pop up"); setModalVisible(true); } } } />
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!