Skip to content

Instantly share code, notes, and snippets.

@kmccarth
Created October 31, 2017 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmccarth/98114c707985343c1861d18cfee389c5 to your computer and use it in GitHub Desktop.
Save kmccarth/98114c707985343c1861d18cfee389c5 to your computer and use it in GitHub Desktop.

Mac OS File Descriptor Limits

React Native apps require a lot of files open at once, so you need to up the allotment for your Mac's OS.

$ sudo atom -a /etc/sysctl.conf;
kern.maxfiles=10485760
kern.maxfilesperproc=1048576

node version

Needs to be 8.5 or above

$ node -v;

node update via brew

$ brew update;
$ brew upgrade node;

npm version

needs to be 4.6.1

$ npm -v;
5.3.0
$ npm i -g npm@4.6.1;
$ npm -v;
4.6.1

Clone from GH

$ git clone git@github.com:kmccarth/va-react-native.git ~/va-react-native;

Optional: branching off master

$ cd ~/va-react-native;
$ export MYFIRSTNAME="EDIT_THIS_VALUE"
$ git checkout -b $MYFIRSTNAME;

npm install (~2-3 minutes)

$ cd ~/va-react-native;
$ npm install;

Using Expo

"Expo apps are React Native apps which contain the Expo SDK. The SDK is a native-and-JS library which provides access to the device’s system functionality (things like the camera, contacts, local storage, and other hardware). That means you don’t need to use Xcode or Android Studio, or write any native code, and it also makes your pure-JS project very portable because it can run in any native environment containing the Expo SDK."

Basically, you can dev locally on your mac, hit save, then see the results on your iPhone or Android phone. No Xcode, no recompiles. But the devices (phone/Mac) need to be on same wifi.

On your iOS device, go to the App store to download the Expo app.

Run app

On Mac, run the following:

$ npm start;

When you see the QR code, open up the Expo iOS app. Use "Scan QR code" feature and hover-over the QR code printed to your Mac terminal

alt text

Finally...

Open up ~/va-react-native/App.js and change the language of "Shake your phone" to "Shake your rumpba", save the file and viola!

Other resources

Create New RN App cli

With this, you can create new apps very easily

$ cd ~;
$ npm i -g create-react-native-app;
$ cd ~;
$ create-react-native-app MyAwesomeProject;
$ cd MyAwesomeProject;
$ npm start;

React Native Upgrade scripts

Unnecessary, but nice to have for down the road. $ npm i -g react-native-git-upgrade;

Node version manager

https://github.com/creationix/nvm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment