Search This Blog

Wednesday, February 22, 2017

Setting up a React-Native dev environment in Windows 10

After days trying, alternating sighs with enthusiastic exclamation marks, I... formatted my computer, threw all my coins in the fountain, and was set to try it for one last time.

This time heavenly miracles agreed to intercede in my favor, so I ended up running the Hello World app.

This post has one sole objective (apart from occasionally hinting that you should only try mobile development (I was assigned the task in my company to try Xamarin before) if you have given up all your dreams about computer science):

Following the official docs instructions should be enough to get you there (the time frame required is, on purpose, not mentioned, neither in their docs nor here. Otherwise no one will ever try it).
You will run into config problems, missing environment variables, but you should be able to get around.

The thing is: the only real successful setting that worked for me is:
  1. Running the app not from another command prompt, as suggested by the docs, but from Android Studio itself. When asked, pick the emulator of your choice
  2. Opening a command prompt, and running react-native start...  and... it works ! (All right, it does not crash fits better)
  3. To "develop", "simply" edit the project's android.js file. 
  4. After editing your js sources, you do not have to shut the emulator, rebuild the app with Android Studio, re-start react-native packager... you can leave all up and running - just hit R + R after focusing in the emulator so the app is rebuilt and refreshed.
Congratulations, we are now on the same boat.
You are welcome to leave a comment advising leading where to.

(I like the complete appocalipytic tone of this post. It came to life after some highly frustrated days :)

No comments:

Post a Comment