/rn-typescript-starter

React Native starter based on Typescript, Redux and React Navigation

Primary LanguageTypeScript

rn-typescript-starter

Simple starter for React Native development with Redux, React-Navigation 5.0 and Typescript. Flipper is enabled by default, RN v.0.63.2.

Setup

This project was bootstrapped with react-native init.

Below you'll find information about performing common tasks. The most recent version of this guide is available here.

Table of Contents

Updating to New Releases

You should only need to update the global installation of react-native-cli very rarely, ideally never.

The most recent version of this guide is available here

Available Scripts

If Yarn was installed when the project was initialized, then dependencies will have been installed via Yarn, and you should probably use it to run these commands as well. Unlike dependency installation, command running syntax is identical for Yarn and NPM at the time of this writing.

yarn start

Runs your app in development mode.

Sometimes you may need to reset or clear the React Native packager's cache. To do so, you can pass the --reset-cache flag to the start script:

yarn start -- --reset-cache
# or
npm start -- --reset-cache

yarn test

Runs the jest test runner on your tests.

yarn ios

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

yarn android

Like yarn 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). We also recommend installing Genymotion as your Android emulator. Once you've finished setting up the native build environment, there are two options for making the right copy of adb available to Create React Native App:

Using Android Studio's adb
  1. Make sure that you can run adb from your terminal.
  2. Open Genymotion and navigate to Settings -> ADB. Select “Use custom Android SDK tools” and update with your Android SDK directory.
Using Genymotion's adb
  1. Find Genymotion’s copy of adb. On macOS for example, this is normally /Applications/Genymotion.app/Contents/MacOS/tools/.
  2. Add the Genymotion tools directory to your path (instructions for Mac, Linux, and Windows).
  3. Make sure that you can run adb from your terminal.

Writing and Running Tests

This project is set up to use jest for tests. You can configure whatever testing strategy you like, but jest works out of the box. Create test files in directories called __tests__ or with the .test extension to have the files loaded by jest. See the the template project for an example test. The jest documentation is also a wonderful resource, as is the React Native testing tutorial.

License

React Native Starter is MIT licensed, as found in the LICENSE file.