Home

Awesome

React Native example using State Machine

This is an example project demonstrating how to use the state-machine-react. library with React Native app. The project showcases:

The state-machine-react is a React-specific wrapper for the core library, simple-state-machine.

Features

Prerequisites

Make sure you have the following installed:

Getting Started

1. Install Dependencies

Clone the repository and install the required dependencies:

npm install

2. Run the unit tests

npm run test

3. Run The Application

Start the Metro Server

To start Metro, run the following command from the root folder of this project:

# using npm
npm start

# OR using Yarn
yarn start

Start your Application

Let Metro Bundler run in its own terminal. Open a new terminal from the root of your React Native project. Run the following command to start your Android or iOS app:

For Android

# using npm
npm run android

# OR using Yarn
yarn android

For iOS

# for the first time run, install pods, not required for subsequent runs.
cd ios
pod install --repo-update
cd ..

# using npm
npm run ios

# OR using Yarn
yarn ios

If everything is set up correctly, you should see your new app running in your Android Emulator or iOS Simulator shortly provided you have set up your emulator/simulator correctly.

This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.