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

110
Vistas
Expo Contacts Returning Partial Results - Missing Contacts

I am creating a personal CRM using the Expo CLI. I'm trying to import the contacts from a users phone into the database and then display those imported contacts.

Currently, it only returns a partial subset of the contacts.

It displays those contacts correctly but it doesn't seem to register the vast majority of contacts when testing on my personal phone, as well as other test phone cases.

I'm using SQLLite as a DB (just to make the code understandable to read!)

I'm just getting the name, first phone number and first email if they exist and sending that to the database. A different function then renders all the contacts from the database.

useEffect(() => {
    (async () => {
      if (!ImportContacts.isAvailableAsync()) {
        if (ImportContacts.getPermissionsAsync()) {
          Alert.alert('If you choose to import contacts, only the name, first phone number, and email will be added.')
        }
      }
      const { status } = await ImportContacts.requestPermissionsAsync();
      if (status === 'granted') {
        const { data } = await ImportContacts.getContactsAsync({
          fields: [ImportContacts.Fields.Emails, ImportContacts.Fields.PhoneNumbers],
        });

        db.transaction(txn => {
          txn.executeSql(
            `CREATE TABLE IF NOT EXISTS cards (
              id INTEGER PRIMARY KEY AUTOINCREMENT,
              name VARCHAR(20),
              phone VARCHAR(20),
              email VARCHAR(35),
              dateAdded TEXT,
              isAce INTEGER,
              image VARCHAR(500)
            )`,
            [],
            (sqlTxn, res) => {
              console.log('table card created');
            },
            error => {
              console.log('error on creating table CARD 123')
            },
          );
        });
    
        for (let i = 0; i < data.length; i++) {
          console.log(data[i]);
          let name = "";
          let phone = "";
          let email = "";
    
          if (data[i].name){
            name = data[i].name;
          }
          if (data[i].phoneNumbers){
            phone = data[i].phoneNumbers[0].number;
          }
          if (data[i].emails){
            email= data[i].emails[0].email;
          }
          db.transaction(txn => {
            //console.log(moment().format("MMM Do YY"));
            txn.executeSql(
              'INSERT INTO cards (name, phone, email, dateAdded, isAce) VALUES (?,?,?,?,?)',
              [name, phone, email, moment().format("MMM Do YY"), 0],
              (sqlTxn, res) => {
                
              },
              error => {},
            );
          });
        }
      }
      else {

      }
    })();
  }, []);
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