How to execute blocking call in different thread in react-native?

304 views Asked by At

I have to make book offline feature in my app. Book consists of 20-50 chapters and 100s of topics within each chapter. To get chapter or topic details, i have to make an api call for each.

The problem is when i start fetching and saving to local storage app get freeze. I can not able to change tabs.

I have tried using InteractionManager but didn't worked. Is there any way to run in different thread for both in ios & android ?

1

There are 1 answers

0
Spencer K On

You can create a separate process and run the api calls on a dedicated thread which will leave the JS and UI threads open for the app instead.

Check out react-native-threads on GitHub.