Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

116
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda