I've been developing a react-native app using the simulator for a while. On the simulator (iOS), the app loads very fast (on reload for eg). However, when I tried to load the app to the device, it spends between 1-3 minutes in the splash screen before loading into the app.
My project is fairly small, and has no extra resources other than the javascript. Looking at the documentation I couldn't find what might be the cause of the issue, though I suspect it has to do with the fact that it is not getting the JS from the packager local server.
What am I doing wrong?
(btw - react-native v0.31)
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.
React Native is great for mobile apps. It provides a slick, smooth and responsive user interface, while significantly reducing load time. It's also much faster and cheaper to build apps in React Native as opposed to building native ones, without the need to compromise on quality and functionality.
React Native is not going to go away any time soon. JavaScript has been around since 1995 and it gives no signs of retiring any time soon — it was the most popular programming language on Stack Overflow's yearly survey for the past few years.
I ran into the same issue and discovered that it was because I was running my app on device in development mode. To get the performance you're looking for, you'll need to build and run the app in production or "release" mode. You can do this by passing in a --configuration
option and setting it to Release
using the React Native CLI
:
$ react-native run-ios --configuration Release
If that doesn't do the trick, then you may need to build your app in "Release" mode from Xcode. To do that, navigate to your projects /ios
directory and open the .xcodeproj
file in Xcode. Choose your build target in the Toolbar. Scroll to the bottom and choose "Edit Scheme...". Then under Build Configuration, switch from "Debug" to "Release". Now build your app on your target device and it should be much more performant than before.
You can read more in the official React Native documentation under Running on Device: Building your app for production.
For me the issue was related to the wifi network of my development machine. I was using WPA2 Enterprise auth to connect to wifi on my development machine. I found that if I used a wired connection to connect to my network or if I used another wifi connection that used a different form of auth then the delay went away. I think the delay is a network timeout.
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