SimonErm/react-native-job-queue

Information about module

Linoa65 opened this issue · 7 comments

Hello !

First, thank you for this module, because for my needs, I have some serious problems with background tasks on react native (promise never resolved until I open my app). I want to know if this module is usable now, and if I will be able to correctly resolve my promises, because I think the fault is from HeadlessJS.

I think with this module I will be able to catch my message with headlessJS, then run a background thread to execute what I need to do. Did you think it's possible ?

There is no index.js, so will I need to use NativeModules object from RN ?

Thanks !
Florient

Hey ,

I want to know if this module is usable now,

Yes it works on Android and iOS but you have to try it from master since it is not published to npmjs so far, but i will try to do this at the weekend.

and if I will be able to correctly resolve my promises, because I think the fault is from HeadlessJS.
I think with this module I will be able to catch my message with headlessJS, then run a background thread to execute what I need to do. Did you think it's possible ?

I never worked with HeadlessJS before, so i am not sure how this library can help you. If you work with background tasks, have you already take a look at https://github.com/jamesisaac/react-native-background-task?

There is no index.js, so will I need to use NativeModules object from RN ?

No you don't have to. The entryFile is specified in the package.json to be from the generated index.js since this project uses Typescript.
You can use it like in the example: https://simonerm.github.io/react-native-job-queue/docs/classes/queue

Really interesting so, I installed it to test if it resolve my problems.

After installation and linking (only on android for now) the project builds, but I get the error that src/index.ts is not found. I checked into node_modules, and there is no folder named src.

error: bundling failed: Error: While trying to resolve module `react-native-job-queue` from file `/Users/florientferrao/IdeaProjects/sweetnewworld_mvp_front/js/services/utils/BackgroundTaskService.js`, the package `/Users/florientferrao/IdeaProjects/sweetnewworld_mvp_front/node_modules/react-native-job-queue/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/florientferrao/IdeaProjects/sweetnewworld_mvp_front/node_modules/react-native-job-queue/src/index.ts`. Indeed, none of these files exist:

  * `/Users/florientferrao/IdeaProjects/sweetnewworld_mvp_front/node_modules/react-native-job-queue/src/index.ts(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
  * `/Users/florientferrao/IdeaProjects/sweetnewworld_mvp_front/node_modules/react-native-job-queue/src/index.ts/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`

Do I need to run something to generate the index.ts ?

Can you run npm install react-native-job-queue@git+https://git@github.com/SimonErm/react-native-job-queue.git --save again and test again? I had the ./src on .npmignore.

Thanks it works, after that I had error like "buffer" is not in the module, but I fixed it with installing the module in my dependencies.

I try your module and give you feedback if there is problem or if it solve my problem ! :)

After fast tests, I got an error crashing my app on addJob method. With stack trace, I think it is because my version of react-native have no access to androidx classes. Do I need to update to RN 0.60 to make it works correctly ?

Do I need to update to RN 0.60 to make it works correctly ?

Yes. I have to update the Readme, i didn't mentioned that RN<60 dont' support androidx

I tested your module and it works good ! But it's unable to resolve my problem, tasks stay as pending until I open my app for firebase promises ...

Thanks for all, I close the issue :)