Convert Figma logo to code with AI

react-native-community logocli

The React Native Community CLI - command line tools to help you build RN apps

2,334
899
2,334
40

Top Related Projects

A framework for building native applications using React

Tools for creating, running, and deploying universal Expo and React Native apps

👷‍♂️ Simple set of CLIs to scaffold and build React Native libraries for different targets

17,313

Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more!

A complete native navigation solution for React Native

Cross-Platform React Native UI Toolkit

Quick Overview

React Native CLI is a command-line interface for React Native, providing a set of tools and commands to create, develop, and manage React Native projects. It serves as the official toolchain for React Native development, offering features like project initialization, running on different platforms, and managing dependencies.

Pros

  • Seamless integration with React Native ecosystem
  • Provides a standardized workflow for React Native development
  • Offers built-in commands for common development tasks
  • Supports custom plugins for extended functionality

Cons

  • Learning curve for developers new to React Native
  • Some commands may be slow on larger projects
  • Occasional compatibility issues with certain third-party libraries
  • Limited customization options for advanced use cases

Code Examples

  1. Creating a new React Native project:
npx react-native init MyAwesomeProject
  1. Running the app on iOS simulator:
npx react-native run-ios
  1. Running the app on Android emulator:
npx react-native run-android
  1. Linking native dependencies:
npx react-native link

Getting Started

To get started with React Native CLI, follow these steps:

  1. Install Node.js and npm (Node Package Manager)
  2. Install React Native CLI globally:
    npm install -g react-native-cli
    
  3. Create a new React Native project:
    npx react-native init MyProject
    
  4. Navigate to the project directory:
    cd MyProject
    
  5. Start the Metro bundler:
    npx react-native start
    
  6. Run the app on your desired platform:
    npx react-native run-ios
    # or
    npx react-native run-android
    

Now you're ready to start developing your React Native app using the CLI!

Competitor Comparisons

A framework for building native applications using React

Pros of React Native

  • Comprehensive framework for building cross-platform mobile apps
  • Extensive documentation and large community support
  • Includes both UI components and native modules

Cons of React Native

  • Larger package size and potentially slower initial setup
  • More complex configuration for advanced use cases
  • Steeper learning curve for beginners

Code Comparison

React Native:

import React from 'react';
import { View, Text } from 'react-native';

const App = () => (
  <View>
    <Text>Hello, React Native!</Text>
  </View>
);

React Native CLI:

npx react-native init MyApp
cd MyApp
npx react-native run-android

Key Differences

  • React Native is the core framework, while React Native CLI is a command-line tool for project management
  • CLI focuses on project initialization, building, and running, while React Native provides the actual development environment
  • React Native includes UI components and APIs, whereas CLI handles project setup and build processes

Use Cases

  • Use React Native for developing the entire mobile application
  • Use React Native CLI for creating new projects, managing dependencies, and running development servers

Community and Support

  • React Native has a larger community and more third-party libraries
  • React Native CLI is maintained by the community, potentially leading to faster updates and improvements for tooling

Tools for creating, running, and deploying universal Expo and React Native apps

Pros of expo-cli

  • Simplified setup and development process
  • Access to a wide range of pre-built components and APIs
  • Easier deployment and over-the-air updates

Cons of expo-cli

  • Limited access to native modules and custom native code
  • Larger app size due to included Expo libraries
  • Potential performance overhead for complex applications

Code Comparison

expo-cli:

import { Camera } from 'expo-camera';

const CameraComponent = () => (
  <Camera style={{ flex: 1 }} type={Camera.Constants.Type.back} />
);

react-native-cli:

import { RNCamera } from 'react-native-camera';

const CameraComponent = () => (
  <RNCamera style={{ flex: 1 }} type={RNCamera.Constants.Type.back} />
);

The code comparison shows that expo-cli uses Expo's pre-built components, while react-native-cli requires installing and linking third-party libraries. Expo's approach simplifies development but may limit customization options.

Both CLIs serve different purposes and cater to different developer needs. expo-cli is ideal for rapid prototyping and simpler apps, while react-native-cli offers more flexibility and control for complex, performance-critical applications.

👷‍♂️ Simple set of CLIs to scaffold and build React Native libraries for different targets

Pros of react-native-builder-bob

  • Simplified setup process for React Native libraries
  • Supports multiple build targets (CommonJS, ES modules, TypeScript)
  • Automated configuration for popular tools like Jest and ESLint

Cons of react-native-builder-bob

  • Limited to library development, not suitable for full app creation
  • May require additional setup for complex project structures
  • Less extensive documentation compared to React Native CLI

Code Comparison

react-native-builder-bob:

npx create-react-native-library example-library
cd example-library
yarn

React Native CLI:

npx react-native init MyApp
cd MyApp
npx react-native run-android

Key Differences

  • react-native-builder-bob focuses on library development, while React Native CLI is for full app creation
  • react-native-builder-bob offers a more streamlined setup process for libraries
  • React Native CLI provides a wider range of commands for app development and management

Use Cases

  • Use react-native-builder-bob when developing reusable React Native libraries or modules
  • Choose React Native CLI for creating and managing full React Native applications

Community and Support

  • React Native CLI has a larger community and more extensive documentation
  • react-native-builder-bob is maintained by Callstack, a reputable React Native development company

Integration

  • Libraries created with react-native-builder-bob can be easily integrated into projects initialized with React Native CLI
  • React Native CLI projects can utilize libraries built with react-native-builder-bob seamlessly
17,313

Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more!

Pros of Ignite

  • Provides a full-featured boilerplate with pre-configured components and best practices
  • Includes a CLI tool for generating screens, components, and other project elements
  • Offers a curated set of popular libraries and tools integrated out-of-the-box

Cons of Ignite

  • Less flexibility for custom project setups compared to the more bare-bones CLI
  • Steeper learning curve due to additional tools and conventions introduced
  • May include unnecessary dependencies for simpler projects

Code Comparison

CLI:

npx react-native init MyApp
cd MyApp
npx react-native run-ios

Ignite:

npx ignite-cli new MyApp
cd MyApp
npm run ios

The CLI provides a basic React Native setup, while Ignite generates a more comprehensive project structure with additional features and conventions.

Key Differences

  • CLI focuses on providing essential React Native commands and project initialization
  • Ignite offers a complete development ecosystem with opinionated project structure
  • CLI allows for more customization from the ground up
  • Ignite emphasizes rapid development with pre-configured tools and components

Use Cases

  • CLI: Ideal for developers who want full control over project setup and dependencies
  • Ignite: Better suited for teams looking for a standardized, feature-rich starting point

Both tools serve different needs within the React Native ecosystem, with CLI offering simplicity and flexibility, while Ignite provides a more opinionated and feature-rich development experience.

A complete native navigation solution for React Native

Pros of react-native-navigation

  • Native navigation performance and animations
  • More advanced navigation features like shared element transitions
  • Better support for complex navigation structures

Cons of react-native-navigation

  • Steeper learning curve and more complex setup
  • Less flexibility for custom navigation implementations
  • Potential compatibility issues with some third-party libraries

Code Comparison

react-native-cli:

import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

const Stack = createStackNavigator();

function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Home" component={HomeScreen} />
        <Stack.Screen name="Details" component={DetailsScreen} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

react-native-navigation:

import { Navigation } from 'react-native-navigation';

Navigation.registerComponent('Home', () => HomeScreen);
Navigation.registerComponent('Details', () => DetailsScreen);

Navigation.setRoot({
  root: {
    stack: {
      children: [
        { component: { name: 'Home' } },
      ],
    },
  },
});

The cli uses a more React-like approach with components, while react-native-navigation uses a more imperative API. The cli is generally easier to set up and use for simpler navigation structures, while react-native-navigation offers more advanced features and better performance for complex navigation scenarios.

Cross-Platform React Native UI Toolkit

Pros of React Native Elements

  • Comprehensive UI toolkit with pre-built components
  • Customizable and themeable components for consistent styling
  • Active community and regular updates

Cons of React Native Elements

  • Larger bundle size due to included components
  • May require additional configuration for specific use cases
  • Learning curve for customizing complex components

Code Comparison

React Native Elements:

import { Button } from 'react-native-elements';

<Button
  title="Click me"
  buttonStyle={{ backgroundColor: 'blue' }}
  onPress={() => console.log('Button pressed')}
/>

React Native CLI:

import { Button } from 'react-native';

<Button
  title="Click me"
  color="blue"
  onPress={() => console.log('Button pressed')}
/>

React Native Elements provides more customizable components with additional props and styling options, while React Native CLI offers basic components that may require more manual styling.

React Native CLI is primarily a command-line tool for creating and managing React Native projects, whereas React Native Elements is a UI component library. The CLI is essential for project setup and development workflow, while React Native Elements enhances the UI development process with pre-built, customizable components.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

React Native Community CLI

Command line tools that help you build apps with react-native, shipped as the @react-native-community/cli NPM package.

Build Status Version MIT License PRs Welcome Lean Core Extracted

Note: CLI has been extracted from core react-native as a part of "Lean Core" effort. Please read this blog post for more details.

Contents

Compatibility

Our release cycle is independent of react-native. We follow semver and here is the compatibility table:

@react-native-community/clireact-native
^14.0.0^0.75.0
^13.0.0^0.74.0
^12.0.0^0.73.0
^11.0.0^0.72.0
^10.0.0^0.71.0
^9.0.0^0.70.0
^8.0.0^0.69.0
^7.0.0^0.68.0
^6.0.0^0.65.0,^0.66.0,^0.67.0
^5.0.0^0.64.0
^4.0.0^0.62.0,^0.63.0
^3.0.0^0.61.0
^2.0.0^0.60.0
^1.0.0^0.59.0

Documentation

About

This monorepository contains tools and helpers for React Native projects in form of a Command Line Tool (or CLI). This CLI is used directly by the react-native package and is not intended for use directly. We update it independently of React Native itself.

Creating a new React Native project

Run the following command in your terminal prompt:

npx @react-native-community/cli@latest init MyApp

Usage in an existing React Native project

Once you're inside an existing project, you can run a series of commands to interact with your projects by using the rnc-cli binary.

Example running start command in terminal:

yarn rnc-cli start

You can also add npm scripts to call it with whichever package manager you use:

{
  "scripts": {
    "start": "rnc-cli start"
  }
}

to call it as

yarn start

Updating the CLI

[!WARNING] Please do it only if you need to. We don't recommend updating CLI independently of react-native as it may cause unexpected issues.

React Native CLI is a dependency of react-native, which makes it a transitive dependency of your project. You can overwrite the version independently of react-native by using resolutions field in your package.json:

{
  "resolutions": {
    "@react-native-community/cli": "VERSION",
    "@react-native-community/cli-clean": "VERSION",
    "@react-native-community/cli-config": "VERSION",
    "@react-native-community/cli-debugger-ui": "VERSION",
    "@react-native-community/cli-doctor": "VERSION",
    "@react-native-community/cli-link-assets": "VERSION",
    "@react-native-community/cli-platform-android": "VERSION",
    "@react-native-community/cli-platform-ios": "VERSION",
    "@react-native-community/cli-server-api": "VERSION",
    "@react-native-community/cli-tools": "VERSION",
    "@react-native-community/cli-types": "VERSION"
  }
}

Maintainers

Previously:

License

Everything inside this repository is MIT licensed.

NPM DownloadsLast 30 Days