Start a React Native Project

React Native is a fast and efficient way to build iOS and Android apps.

This article describes a MacOS laptop setup and Vim configuration for React Native with:

Install dependencies

Install dependencies using Homebrew and NPM:

brew update
brew install node
brew install watchman
brew cask install expo-xde
brew upgrade
brew cleanup
brew cask cleanup
npm install prettier --global

Develop using Expo XDE

Expo is a set of free tools that allows us to work on JavaScript-only React Native apps without installing XCode or Android Studio.

Expo XDE was previously installed via Homebrew Cask. Open it now.

Create an account or sign in. Create a new project from their dropdown menu. This will download the appropriate files and build the project.

Test the app on your phone

Download the Expo Client iPhone app. Open it.

From within the Expo Client app, scan the project's QR code in the Expo XDE.

Expo Client reloads the app on your phone!

Configure your text editor

For Vim, install these plugins:

Plug 'mxw/vim-jsx'
Plug 'pangloss/vim-javascript'
Plug 'sbdchd/neoformat'

Configure Neoformat and Prettier:

" Auto-format on save
augroup fmt
  autocmd BufWritePre *.js,*.jsx Neoformat prettier
augroup END

Edit the codebase in a text editor

Edit a file such as screens/HomeScreen.js in Vim. Save the file.

Prettier re-formats it on save! (no linting necessary)

Expo Client reloads the app on your phone!