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

257
Visualizações
How to add react-native-background-thread to the code?

I am very new to React-Native and JS. Any help or suggestions will be appreciated.

I want to add a background thread to the code and my teammate came across this library https://www.npmjs.com/package/react-native-js-background-thread. After reading the description we decided to go for this as we don't need some fancy library that runs thread in the background even the app is closed or in the background.

There is runAsync method that need to called to run the thread I suppose. I having hard time implementing it. Can someone explain with an example please?

This is how I am trying to use:

const runMe = (a, b) => {
 let count=0;
 for(let i=0; i<a; i++){
  for(let j=0; j<b; j++){
   count++;
  }
 }
 return JSON.stringify(count);
};

runAsync(this.runMe, 'runMe', [200000, 10000])
 .then(result => {
        console.log('output: ', result);
 });

And I am getting the following error:

ERROR TypeError: null is not an object (evaluating 'RNReactNativeJsBackgroundThread.runAsyncCode')

ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.

This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

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