Skip to content

Create a React Native app on any OS with no build config.

License

Notifications You must be signed in to change notification settings

webscp/create-react-native-app

 
 

Repository files navigation

Create React Native App

Create React Native apps with no build configuration.

tl;dr

Make sure you have Node 6 or later installed. No Xcode or Android Studio installation is required.

# substitute for appropriate yarn commands if it's installed
$ npm install -g create-react-native-app

$ create-react-native-app my-app
$ cd my-app/
$ npm start

Install the Expo app on your iOS or Android phone, and use the QR code in the terminal to open your app. Find the QR scanner by pressing the '+' menu on the Projects tab. When you're ready to share your project with others (for example, by deploying to an app store), read the Sharing & Deployment section of the User Guide.

Create React Native App allows you to work with all of the Components and APIs in React Native, as well as most of the JavaScript APIs that the Expo App provides.

Sections

Getting Started

Installation

Install it once globally:

$ npm install -g create-react-native-app
  # or
$ yarn global add create-react-native-app

You'll need to have Node >= 6 on your machine. We strongly recommend using npm >= 3 or a recent version of yarn.

Creating an App

To create a new app, run:

$ create-react-native-app my-app
$ cd my-app

This will create a directory called my-app inside the current working directory. Inside my-app, this will generate the initial project structure and install all of its dependencies.

If you're familiar with React Native already, you won't find any ios or android directories in this project, just JavaScript. Once this installation is done, there are some commands you can run in the project directory:

npm start

Runs your app in development mode.

Open it in the Expo app on your phone to view it. It will reload if you save edits to your files, and you will see build errors and logs in the terminal.

npm test

Runs the jest test runner on your tests.

npm run ios

Like npm start, but also attempts to open your app in the iOS Simulator if you're on a Mac and have it installed.

npm run android

Like npm start, but also attempts to open your app on a connected Android device or emulator. Requires an installation of Android build tools (see React Native docs for detailed setup).

npm run eject

This will start the process of "ejecting" from Create React Native App's build scripts. You'll be asked a couple of questions about how you'd like to build your project.

Warning: Running eject is a permanent action. Please use a version control system, such as git, so you can revert back if necessary. An ejected app will require you to have an Xcode and/or Android Studio environment set up.

User Guide

Please refer to the User Guide for more details about CRNA specifically.

Once you're up and running with CRNA, visit this tutorial for more information on building apps with React Native.

Philosophy

  • Minimal "Time to Hello World": Create React Native App should reduce the setup time it takes to try building a mobile app to the absolute minimum, ideally on par with React web development (especially as seen with Create React App).
  • Develop on Your Device: It should be easy to develop on a physical device when you want to test how your app feels and responds to inputs.
  • One Build Tool: If you just want to get started with React Native, you shouldn't need to install Xcode, Android Studio, NDKs, or mess with environment variables.
  • No Lock-In: You can always "eject" to your own build setup if you need to write custom native code or modify how your app is built.

Limitations and Capabilities

The main limitation of a CRNA project is that it must be written in pure JavaScript and not have any dependencies which rely on custom native code (i.e. ones which require running react-native link to work). This allows the projects to load directly on a phone without native compilation, and also means that it's not necessary to install or use Android Studio or Xcode.

Apps made with Create React Native App support everything in the Components and APIs sections of the React Native Documentation.

Apps made with Create React Native App also support most of the JavaScript-to-Native APIs provided by the Expo SDK, since they are loaded by the Expo app.

If you're sure that you need custom native code, please read the ejecting guide.

If you need to build IPAs and APKs for publishing to the App Store and/or Play Store, you can either eject (see above guide) and build them yourself using Xcode and Android Studio, or you can use a service like Expo's standalone app builds to publish your pure JS app.

Support and Contact

If you're having issues with Create React Native App, please make sure:

If you've checked the documentation and currently open issues, please either open a new GitHub issue, find @dika10sune on Twitter, or ping dikaiosune on Reactiflux's #react-native channel on Discord. Please do not DM or email project maintainers directly, as it's very important that support takes place in public locations where others can benefit from the conversation.

Contributing

Contributions will be licensed under the 3-clause BSD license. Please fork the repository, perform your work on a feature branch, and submit a pull request to this repository's master branch from your fork's branch.

For details about setting up a development environment and testing your changes, please see CONTRIBUTING.md.

About

Create a React Native app on any OS with no build config.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%