0

I have a react native app and I'm using an android native module to run a long task. While this task is going on, I would like to show a progress bar in my react native screen while this task is going on. How do i do this? I'm currently only able to get a callback once my long running task is over.

I want to be able to show meaningful progress. Like 10% done. Not just a loading spinner.

1 Answer 1

0

This requires that your native module is constantly emitting to the js context the progress, like 5%, 10% etc. (Check official docs about how to do the emission). Then, subscribing to this event, you can update your progress bar with the actual percentage. I would use the paper's progressBar.

Of course, if your task is timed-based, i.e you know it will finish after 2 seconds, you can just add an interval on the js side and update accordingly the progressBar, i.e every 100ms you can progress it by 5%.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.