Performed current drain test on sample (Welcome to React Native) app when the app was in background for an hour and the results are as follows:
Sample application with RN version 34 : 31.54mA Sample application with RN version 22 : 24.60mA
Where as the sample native android app only consumes about 10mA
in the same scenario.
Tools Used :
Power monitor (H/w) Power tool (S/w)
1) Can anybody confirm the above test and explain the reason behind high current drain ?
2) Is it normal for react native apps to have higher current drain values as compared to the native android app?
React Native version: RN 0.22 and RN 0.34 Platform : Android
In React Native, performing a task in the background might seem daunting at first. It is not as simple as writing a function in JavaScript, where the function is executed even after the activity is killed. Instead, React Native uses Headless JS to execute JavaScript code in the background.
Slow app launch is another issue of React Native apps. If your app opens too slowly, you probably have too many dependencies in your app and you're using slow components. Try to use fast, high-performance components and decrease the number of dependencies in your app. For example, the Object.
Even without using hot reloading, app build time is significantly faster using React Native than on native iOS and Android, and live reloading mechanism can be used to automatically reload the app every time the code is changed, without having to build it manually every single time.
While I do not know the internals, I believe the following statement is a good hypothesis;
Even when you have installed the application in release mode (in other words, there is no npm server and the app uses local .jsbundle) React Native has to keep two things working;
I believe, due to this added load, a react native app should consume more power, assuming everything else is equal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With