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

253
Vistas
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 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