React Native Expo Plugin for Nx
Getting started
Create a new Nx workspace:
npx create-nx-workspace --cli=nx --preset=empty
Install React Native Expo plugin
# Using npm
npm install --save-dev nx-react-native-expo
# Using yarn
yarn -D nx-react-native-expo
Create an app
npx nx g nx-react-native-expo:app <app-name>
When using Nx, you can create multiple applications and themes in the same workspace. If you don't want to prefix your commands with npx, install @nrwl/cli
globally.
Start the bundler
npx nx start <app-name>
Run on devices
Android:
npx nx run-android <app-name>
iOS:
npx nx run-ios <app-name>
Web:
npx nx run-web <app-name>
Build the app
npx nx bundle <app-name>
npx nx bundle <app-name> --platform=ios
npx nx bundle <app-name> --platform=android
Using components from React library
You can use a component from React library generated using Nx package for React. Once you run:
npx nx g nx-react-native-expo:lib ui-button
This will generate the UiButton
component, which you can use in your app.
import { UiButton } from '@myorg/ui-button';
Learn more
Visit the Nx Documentation to learn more.